Page 1 of 2
HTML source code Non-English character issue
Posted: Sun Nov 03, 2013 10:19 pm
by ARAS
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
Re: HTML source code Non-English character issue
Posted: Sun Nov 03, 2013 11:28 pm
by FourthWorld
Instead of "file:" try "binfile:"
Re: HTML source code Non-English character issue
Posted: Mon Nov 04, 2013 11:58 pm
by ARAS
FourthWorld wrote:Instead of "file:" try "binfile:"
Hi FourthWorld,
Sorry for the late reply.
Unfortunately it didn't work
ARAS
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 8:07 am
by snm
Try:
Code: Select all
set the unicodeText of fld "Field 1" to uniEncode (URL ... , "UTF8")
Marek
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 9:09 am
by ARAS
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
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 10:12 am
by snm
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
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 11:27 am
by ARAS
Thanks Marex,
The code works now, but now the instead of showing weird characters, it deletes those characters.
ARAS
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 11:40 am
by snm
Check if your file is UTF-8 coded. Could you attache it (zipped)? For my UTF-8 text files it's working correct.
Marek
Re: HTML source code Non-English character issue
Posted: Tue Nov 05, 2013 4:55 pm
by ARAS
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
Re: HTML source code Non-English character issue
Posted: Wed Nov 06, 2013 12:04 am
by ARAS
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.
Re: HTML source code Non-English character issue
Posted: Wed Nov 06, 2013 9:05 am
by snm
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
Re: HTML source code Non-English character issue
Posted: Wed Nov 06, 2013 10:14 am
by ARAS
Thank you Marek. I appreciate your help.
Aras
Re: HTML source code Non-English character issue
Posted: Wed Nov 06, 2013 10:48 pm
by icouto
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!
Re: HTML source code Non-English character issue
Posted: Sat Nov 09, 2013 11:24 am
by ARAS
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
Re: HTML source code Non-English character issue
Posted: Sat Nov 09, 2013 11:52 am
by snm
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