Jump to content

[HELP] How to use Unicode for Vietnamese in AutoIt


Recommended Posts

I try to use Unicode for Vietnamese in AutoIt. Firstly, in SciTE, I set Encoding - Unicode and test very simple code:

MsgBox(0, "Test Unicode", "Thử sử dụng Unicode trong AutoIt")

Go, and here's result:

Posted Image

Everything seems to be OK. However, I compile this code, I got unexpected result:

Posted Image

How can I repair this? Please help me!!

Edited by RuanMengXiong
Link to comment
Share on other sites

In Scite you need to save your source(s) in UTF-8 format. File >> Encoding >> UTF-8 with BOM. Then change anything in your source file (e.g. add space then remove it) then save it. Your source will now be in UTF-8.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Firstly, allow me to thank for your replies!

@Jos: I use the lastest version of AutoIt and SciTe

@jchd:

1. I had changed Encoding to UTF-8 with BOM and tried with UTF-8. Both of them result in my target when I press F5 (not yet compiled), but as I said, when I compiled this code, the result is that Unicode characters become "?", even my code in SciTe, the Unicode characters become "?" too!

2. I had tried to use Notepad++ to code... The result is the same!

Link to comment
Share on other sites

  • Developers

So what is the answer to the second question? :unsure:

Tell us more about your environment...

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Try running the attached test script. It's already in UTF-8 and works great AFAIK.

It's possible that the default font used for your Windows MsgBox won't be able to display _all_ glyphs tested but it should work for most of them (specially Vietnamese!).

UTFtest.au3

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@Jos: I ran script on Windows XP SP3 x86 (United States version) - Core2Duo/3GB RAM

@jchd: I tested your script on Windows 7 SP1 x64 (United States version) - Core i7/8GB RAM

And here is the result when I press F5 on SciTE:

Posted Image

And here is the result when I run compiled EXE file:

Posted Image

P/S: I want to show 11 pictures corresponding to 11 languages in your code but forum's rule doesn't allow! So, if you want, you can click HERE to see all of pictures that I run your code and the compiled exe file!

Edited by RuanMengXiong
Link to comment
Share on other sites

Strange! What is your regional setting?

Can you also post the output of the Scite console after compiling the script?

Here's what I get:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "D:\XLequit\AutoMAT\Test\UTFtest.au3" /autoit3dir "C:\Program Files\AutoIt3"

+>09:01:51 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:040C Keyboard:0000040C OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)

! ***************************************************************************************************

! * Input file is UTF8 encoded, Au3Check/Tidy/Obfuscator do no support UNICODE and will be skipped.*

! ***************************************************************************************************

>Running:(3.3.6.1):C:\Program Files\AutoIt3\aut2exe\aut2exe.exe /in "D:\XLequit\AutoMAT\Test\UTFtest.au3" /out "D:\XLequit\AutoMAT\Test\UTFtest.exe" /nopack /comp 2

+>09:01:53 Aut2exe.exe ended.rc:0

>Running:(3.3.0.0):C:\Program Files\AutoIt3\aut2exe\upx.exe" --best --compress-icons=0 -qq "D:\XLequit\AutoMAT\Test\UTFtest.exe"

654803 -> 309203 47.22% win32/pe UTFtest.exe

+>09:01:54 UPX Ended: rc:0

+>09:01:54 Created program:D:\XLequit\AutoMAT\Test\UTFtest.exe

->09:01:54 Warning: This is an Unicode compiled script and will not run on Win9x/ME.

>Exit code: 0 Time: 3.712

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Here is mine

>"C:\Program Files\AutoIt\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "D:\UTFTest.au3"
+>15:08:35 Starting AutoIt3Wrapper v.2.0.1.24    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
! ***************************************************************************************************
! * Input file is UTF8 encoded with BOM, Au3Check does not support UNICODE and will be skipped.     *
! ***************************************************************************************************
-> 1 Change(s) made.
>Running:(3.3.6.1):C:\Program Files\AutoIt\aut2exe\aut2exe.exe  /in "D:\UTFTest.au3" /out "D:\UTFTest.exe" /nopack /comp 2
+>15:09:22 Aut2exe.exe ended.rc:0
>Running:(3.3.0.0):C:\Program Files\AutoIt\aut2exe\upx.exe" --best --compress-icons=0 -qq "D:\UTFTest.exe"
    648001 ->    302401   46.67%    win32/pe     UTFTest.exe
+>15:09:23 UPX Ended: rc:0
+>15:09:23 Created program:D:\UTFTest.exe
->15:09:23 Warning: This is an Unicode compiled script and will not run on Win9x/ME.
>Exit code: 0    Time: 47.981
Link to comment
Share on other sites

What is "1 change(s) made" ?? Are you by chance using any option like productversion autoincrement? Wrapper doesn't handle gracefully UTF-8 files, thus any option causing it to modify the source file won't work as expected.

I had a similar problem long ago and finally decided to change my copy of wrapper to handle Unicode source.

Also why is your compile run that slow?

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Developers

Ok understand the problem now:

You are using UTF8 with BOM, and the version of AutoIt3wrapper you use have an issue and rewrites the file because it "thinks" there is an update to the resources. (latest beta version fixes that bug)

Autoit3Wrapper doesn't support UTF8 with BOM currently thus changes the file back to standard encoding.

Just do F7 and you will see things work fine.

I need to see if I can make the GUI portion to work correctly with UTF encoded files.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Try the current beta AutoIt3Wrapper v2.0.1.37 that now supports utf encoded files in AutoIt3Wrapper coded by jchd.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...