3 posts in this topic
I need help with unicode char Ã¼ I get some text from online json but if try to read 4 example Zürich I heave ZÃ¼rich.
How can I convert with autoit unicode to a clear character readable? thx
I'm using the code below to send mails using our internal relay server.
We got a Helpdesk system named Remedy. Our users can send us a mails using outlook 2010, and we'll get a ticket.
The problem is if I send a mail using the above script our ticket system can't display unicode characters, like ex: Æ Ø Å. It will display them as: questionmarks: "? ? ?" inside our ticket system. In the outlook inbox it looks fine showing unicode symbols, but in our ticket system the unicode characters will be replaced by questionmarks.
The thing is, if they send a mail using outlook, it works fine, but using the script above it doesen't.
I tried to save my script with encoding: UTF-8 with BOM, but it didn't fix it.
All suggestions are very welcome
I've ported toUTF8() function (truly, the whole Encoding class) by Sebastián Grignoli to AutoIt. It offers useful functions to force a string to be in a specified charset in a really easy way.
From the readme file:
$utf8_string = toUTF8($utf8_or_latin1_or_mixed_string) $latin1_string = toLatin1($utf8_or_latin1_or_mixed_string) Also:
$utf8_string = fixUTF8($garbled_utf8_string) fixUTF8() converts the string to UTF-8 repeatedly until make sure it has only UTF-8 valid chars (it's really UTF-8).
#include 'forceutf8.au3' MsgBox(0, '', fixUTF8( 'Ã£Ã©' ) ) Will output:
ãé Note that it's just a port. If you look at both the source codes together (PHP and AutoIt), you'll see that they're exactly the same thing, but in different approaches (PHP arrays converted to Scripting.Dictionary objects, function renames, syntax porting, a few functions completely rewritten due to differences between PHP and AutoIt). Therefore, all credits goes to Sebastián Grignol.
It seems that it works only with latin/roman alphabet (used by English).
Download ZIP from Github
Fork me on Github
sqlite database written in ANSI code reading？The current version is based on UTF 8 encoding to read and write。
UNICODE or ANSI transfer method
I made a small program that should get the unicode code of an array, save it in a variable, and write it into an file. That should be done for every array of a string.
For $i = 0 To $len Step 1 ; $len is the length of the text I enter previously $tmp0 = ChrW($text[$i]) ; $text is the text FileWrite($f, $tmp0 & @CRLF) ; $f is the file I write into $tmp0 = "" Next Building and compiling finish without raising warnings or errors, but the program fails when it's supposed to get the unicode code of that array...
The error message says "Line 357 (File "D:\documents\coding\Crypt\Crypt.exe"): Error: Subscript used on non-accessible variable."
My code ends at line 141, so it's not a problem with my code as such. I'd say that ChrW() isn't able to handle the variable I give it. I don't think it's a problem with the string, but I suspect that it's because I use a variable as an index ($text[$i]).
If my clue was right, how do I fix it? If not, what could be the problem? Thanks for the help!