HTML source code Non-English character issue

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

HTML source code Non-English character issue

Post by ARAS » Sun Nov 03, 2013 10:19 pm

Hello all,

When I use this code for getting the source code of a local html file, some of the Turkish words containing İ,Ç,Ğ,Ş letters becomes like ›,«,–

Code: Select all

put URL "file:/Users/Aras/Developer/detail.html"  into Field 1
Any ideas?
Regards,
ARAS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: HTML source code Non-English character issue

Post by FourthWorld » Sun Nov 03, 2013 11:28 pm

Instead of "file:" try "binfile:"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Mon Nov 04, 2013 11:58 pm

FourthWorld wrote:Instead of "file:" try "binfile:"
Hi FourthWorld,

Sorry for the late reply.
Unfortunately it didn't work :(

ARAS

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: HTML source code Non-English character issue

Post by snm » Tue Nov 05, 2013 8:07 am

Try:

Code: Select all

set the unicodeText of fld "Field 1" to uniEncode (URL ... , "UTF8")
Marek

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Tue Nov 05, 2013 9:09 am

snm wrote:put URL "file:/Users/Aras/Developer/detail.html" into Field 1
Hi Marek,

Am I doing sth wrong? I've gotten an error says expression bad factor near ":/".

Code: Select all

set the unicodeText of fld "Field 1" to uniEncode (URL file:/Users/Aras/Developer/detail.html , "UTF8")
ARAS

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: HTML source code Non-English character issue

Post by snm » Tue Nov 05, 2013 10:12 am

Should be:

Code: Select all

set the unicodeText of fld "Field 1" to uniEncode (URL "file:/Users/Aras/Developer/detail.html" , "UTF8")
The direct path (not put into variable) should be inside quotes.

Marek

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Tue Nov 05, 2013 11:27 am

Thanks Marex,

The code works now, but now the instead of showing weird characters, it deletes those characters.

ARAS

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: HTML source code Non-English character issue

Post by snm » Tue Nov 05, 2013 11:40 am

Check if your file is UTF-8 coded. Could you attache it (zipped)? For my UTF-8 text files it's working correct.

Marek

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Tue Nov 05, 2013 4:55 pm

Hi Marek,

I have checked the html codes. I have seen this lines.

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<meta http-equiv="Content-Language" content="tr">
Therefore, it is windows-1254 I believe.

Do you have any solution for windows-1254?

Regards,
ARAS

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Wed Nov 06, 2013 12:04 am

When I use this code, I get the letters "ç,ş,ğ" correct, but "ı" and "İ" disappears.

Code: Select all

 put URL "file:/Users/Aras/Developer/detail.html"  into Field 1
put ISOtoMAC(fld "Field") into fld "Field"
   
Marek, by the way, I am sorry. I was at work when I last reply. I can't upload the file because it is work related. :(

I know it would be much more easier to solve the problem.

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: HTML source code Non-English character issue

Post by snm » Wed Nov 06, 2013 9:05 am

ARAS, I'm sorry, but I have no idea how to work with windows-1254 charset. But I hope it's possible some conversion of such text to unicode, which is supported by LC.

Marek

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Wed Nov 06, 2013 10:14 am

Thank you Marek. I appreciate your help.

Aras

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am

Re: HTML source code Non-English character issue

Post by icouto » Wed Nov 06, 2013 10:48 pm

A couple of suggestions:

1) make sure the field you are putting the text into is using a font that can display the characters appropriately - i.e., a unicode font.

2) the documentation for the 'uniEncode' mentions 'Turkish' specifically as an encoding type - have you tried using that instead of 'UTF8'? The documentation page for the 'uniEncode' function is here:

http://livecode.com/developers/api/6.0. ... uniEncode/

3) If the file contains simple HTML, you may try using the HTMLText property, instead of the unicodeText - sometimes it's easier. The documentation for the 'htmlText' property is here:

http://livecode.com/developers/api/6.0. ... /HTMLText/

I hope this helps!

ARAS
Posts: 55
Joined: Sat Nov 02, 2013 5:35 pm

Re: HTML source code Non-English character issue

Post by ARAS » Sat Nov 09, 2013 11:24 am

Hi icouto,

Thanks for the suggestions and links.

1. I changed my font to Calibri, which works with Turkish, but I didn't work.
2. uniEncode Turkish didn't work. It just puts different characters for Turkish characters

Code: Select all

put uniEncode(URL "file:/Users/Aras/Developer/detail.html","Turkish") into Field "Field"
3. I used the code below, it doesn't put the words properly(and still problem with Turkish characters)

Code: Select all

set the HTMLText of field "Field" to URL "file:/Users/Aras/Developer/detail.html"
ARAS

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: HTML source code Non-English character issue

Post by snm » Sat Nov 09, 2013 11:52 am

if you can't send your work related html, so please send some other file, which also doesn't work in similar way. You can also edit your file so we can't see "secret" data.

Marek

Post Reply