Jump to content

Autoit3Wrapper character encoding problem


kyo
 Share

Recommended Posts

  • Developers

It could very well be that there is still one in "C:\Program Files (x86)\AutoIt3\SciTE" and it all depends how you have installed.

In the past, that was the standard location which was changes to %SCITE_USERHOME% in case this exists. Simple way to figure out what is the correct one is using the Options\Open user Options file  in the SciTE Menu.

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

  • Replies 83
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Update:

When using ConsoleWrite("Effacé") -  I get this in the console: (darnit, can't paste what I see)

Looks like this, with the "xE9" on black background.

EffacxE9

Looks like the encoding is messing things again...

Link to comment
Share on other sites

  • Developers

This is a known issue and can be "corrected" by this code from @jchd:

ConsoleWrite(BinaryToString(StringToBinary($s, 4), 1))

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

OK, it seems the dust has settled about the encoding issue. Warm thanks to Jos for being that responsive.

Guys, make the line of code Jos mentionned a function named _ConsoleWrite and use it whenever you expect non-ANSI chars, more precisely when you expect chars outside the system/user codepage you're using. Remember it's working for displaying Unicode chars provided you use the setting output.code.page=65001.

To sum up:

  • either you leave output.code.page=0 and you're stuck to using std ConsoleWrite with ANSI-only chars (chars not in your codepage will display as ?)
  • or you set output.code.page=65001 and then need to use _ConsoleWrite when displayed strings may contain chars > 0x7F. With this settings chars in [0x80..0xFF] display like blacked out xE9 with std ConsoleWrite. You may as well use _ConsoleWrite at all times without thinking.

Hope this clears things up. If you still experience issues, just speak up.

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

another "UTF-8 - related" problem:

"NewFileEncoding=UTF8 + utf8.auto.check=4" work for "main script", but if you have includes with non-english characters, then all of them should be converted to UTF-8 also.

If not - compiled script will not work as expected - any non-english characters in menus/titles will not be recognised and autoit-written tray menus will go blank.

 

Link to comment
Share on other sites

  • Developers

You will have to be more specific what you are doing and which utility is corrupting.
So what are you doing for it to break?

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

if i'm not doing anything - it break. If i'm reencoding written by me includes from "code page" to "utf8" - everything OK.

if TrayCreateItem()  is placed in "code page" encoded include and have any non-english characters in "text" part then those characters will not be visible if you run compiled script.

Same with $iIndex = _GUICtrlMenu_FindItem ($hMenu, $sRequired_Text) - it will not find required text

 

 

 

Link to comment
Share on other sites

  • Developers

Yes you are doing something and that something you need to tell me. :)

Are you running, compiling?
From SciTE or external?
Are you using tidy/au3stripper?
Need input ... all the gory details!!!!

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

I give up ....
Let me know when you are able to provide all details for me to be able to replicate else others can perform the miracle you are expecting.

Jos

EDIT: p.s. ensure you test with the available beta's as there are some fixes there  for include files and au3stripper.

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

@Jos

I think this is somehow related to this:

But this was fixed .

btw.
I still have some other problems but actually after my vacation I'm litlle off. So I think I can find my issue in my case in some near feature.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I also noticed today that au3stripper breachs all my german "umlauts" like äöü when cimpiling scripts. Without au3tripper the exes work just fine..

I tried with rightclick ->compile eith options and the tried with and without au3stripper, no options for au3stripper used

i tried with release and beta autoit and with the latest scite beta files...

Edited by Allow2010
Link to comment
Share on other sites

  • Developers

Folk,

I appreciate feedback but please remember I am sailing blind unless somebody shares the files causing the problem and tell me the exact versions they are using.

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

Versions:

Autoit: v3.3.14.1

(as the problems comes up without the beta as well, i did install only final version)

Editor: 29-7-2015 and also latest beta files

[[ ]] Au3Stripper.exe 14-Aug-2015 13:14 137K  
[[ ]] AutoIt3Wrapper.au3 22-Aug-2015 22:10 264K  
[[TXT]] History.html 22-Aug-2015 22:14 104K  
[[ ]] SciLexer.dll 04-Aug-2015 16:34 765K  
[[ ]] SciTE.exe 04-Aug-2015 16:35 919K  
[[ ]] Tidy.exe 04-Aug-2015 16:25 148K  
[[TXT]] au3.properties 02-Aug-2015 15:56 16K  

use the attached au3 and right click. select compile with options, enable au3stripper, compile

the resulting stripped au3 has the errors, but the exe still works (not sure why, i also have problems with the exe with my real code)

i am still trying to prepare an example where the exe also displays the broken characters...

 

 

 

test.zip

Edited by Allow2010
Link to comment
Share on other sites

finally i found the problem...

It is a very unique combination of things:

  • The au3 is UTF8-DOS
  • the include is DOS (no utf)
  • both have umlaute (öäü...)
  • the include is used in the au3

when you run it or compile it without au3stripper it works fine, when you use au3stripper it creates problems with the text

When i convert the include from DOS to U8-DOS (Ultraedit can do this) the problem is gone.

One more thing: When i open existing script, scite opens them different than it did in earlier version or some setting got lost:

File-Encoding is set to Code Page Property.

this results in displayerrors for my scripts (see first picture)

When i change to UTF-8 ist look OK, but i have to change it everytime i open the script...any idea on this? Never had this before...

scite_wrong umlauts.jpg

ultraedit good umlauts.jpg

example.zip

Edited by Allow2010
Link to comment
Share on other sites

i tried to get rid of the problem by converting my au3 files to DOS ASCII instead of UTF-8.

This works fine (no au3stripper problems and not strange characters in scite), until i use rightclick "compile with options". This converts the au3 back to utf-8 and my problems start again...

Edited by Allow2010
Link to comment
Share on other sites

  • Developers

So this is happening when this combination of files is merged by au3stripper?
Au3stripper currently recognises the file encoding when it has a BOM, else it simply merges the files together in a file with a file encoding used by the master script.
Wondering If I need to do any conversions along the way in case of different encoded files.

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...