rcmaehl

ConsoleWrite only outputting ASCII/ANSI?

12 posts in this topic

I might be doing something wrong but I'm running a CUI compiled application in Powershell ISE and it's not outputting unicode characters in the console. I for a fact Powershell ISE supports unicode so I'm thinking it's something with AutoIt. Does ConsoleWrite just not output Unicode? Do CUI compiled applications run inside the old Windows Console when executed through Powershell? is there something else preventing this?


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites



Should work with console in UTF8 and consolewriting string converted to UTF8.


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)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

15 hours ago, jchd said:

and consolewriting string converted to UTF8.

What do you mean? I mean if I run in Powershell:

echo η γλώσσα μου έδωσαν ελληνική

It outputs

η γλώσσα μου έδωσαν ελληνική

However, if I run a compiled CUI autoit script that's just

ConsoleWrite("η γλώσσα μου έδωσαν ελληνική" & @CRLF)

It outputs

? ???ssa µ?? ?d?sa? e???????

Is there a setting I have to set in Autoit?

 

Edit: Never mind. Under "Unicode Support" it clearly states:
 

Quote

Console operations are converted to ANSI.

 

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

What does this do?

ConsoleWrite(BinaryToString(StringToBinary("η γλώσσα μου έδωσαν ελληνική", 4), 1) & @CRLF)

 


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)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

4 minutes ago, jchd said:

What does this do?

ConsoleWrite(BinaryToString(StringToBinary("η γλώσσα μου έδωσαν ελληνική", 4), 1) & @CRLF)

 

Writes properly in SciTE console now before compiling. After compiling Powershell outputs:

η γλώσσα μου έδωσαν ελληνική

instead of 

? ???ssa µ?? ?d?sa? e???????



However, I noticed after posting the last post that in Unicode Support in the help file it states:

Quote

Console operations are converted to ANSI.

Which means I probably need to put in a feature request ticket for this in the bug tracker if possible.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Maybe there is a possibility to set the console to Unicode (UTF8), by forcing "chcp 65001" or something equivalent as the initial default codepage setting, but I'm not much experienced with CUI.


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)

Share this post


Link to post
Share on other sites
Just now, jchd said:

Maybe there is a possibility to set the console to Unicode (UTF8), by forcing "chcp 65001" or something equivalent as the initial default codepage setting, but I'm not much experienced with CUI.

Already tried that. Nothing changed.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

There must be a registry setting hidden somewhere, but only MS knows where.


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)

Share this post


Link to post
Share on other sites

Are you saying that it works compiled on your system?


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Yes I made it work. In registry go to HKCU/Console and add two new keys:

CodePage (DW) = FDE9 (this is 65001)

Facename (String) = "Lucida Console" (warning, case sensitive!!!)

#AutoIt3Wrapper_Change2CUI=y

ConsoleWrite(BinaryToString(StringToBinary("η γλώσσα μου έδωσαν ελληνική ЊЋЌЎЏАБВГДЕЖЗИЙКЛЩЯ ⅛⅜⅝⅞ ∙≠≡≤≥⌂", 4), 1) & @CRLF)
Sleep(5000)

You can use any fixed pitch font, like DejaVu Sans Mono, etc. Change window size, fontsize, ... accordingly so that out is easily readable.

EDIT: forgot to mention that it's quite possible that some other CUI tool wouldn't like those settings. Also verify that your system boots correctly after changes.

Best of luck!

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)

Share this post


Link to post
Share on other sites
On 4/11/2016 at 11:33 AM, jchd said:

EDIT: forgot to mention that it's quite possible that some other CUI tool wouldn't like those settings. Also verify that your system boots correctly after changes.

Ouch. Would prefer not to suggest changing the registry with something that could mess up boot as a bypass to a glitch I can't fix.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Since this setting is in user reg space, I don't believe it would stop booting. Also you can change regsitry at program startup and revert changes at termination. Just try.


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)

Share this post


Link to post
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

  • Similar Content

    • fosil
      By fosil
      Hi everyone.

      I'm currently working a program that constantly prints out log files through "consolewrite" and the "#AutoIt3Wrapper_Change2CUI=y" wrapper.

      Part of this program requires me to run a batch script.

      My issue is the batch script launches from the same window as consolewrite. I need the batch file to be launched through a different window as currently this causes an issue with the logs (which need to be very precise) but also causes the batch file to produce some funny behavior...

      Does anyone know how I can force the file to run on a second DOS window?

      Thanks in advance!!!
       
      Edit: Im using the "run" command if that helps. I tried "shellexecute" but that seemed to not launch the batch scripts at all.
    • Reizvoller
      By Reizvoller
      Hello!
      So I have a little script here 
      Func getThe () Local $nearPix = 0123 Local $winPos = WinGetPos ($workWin) FFSaveBMP ("yBarPosArea", "True" , 600, 239, 600, 555, 30, $workWin) $nearPix = FFNearestPixel (600, 220, "0xC1C1C1" , False, $workWin) If $nearPix == 0123 Then ConsoleWrite ("No val for NearPix") ElseIf $nearPix <> 0123 Then ConsoleWrite ("Val is there") ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) EndIf EndFunc And when it comes time to run it I get a return of 
      When it says "non-accessible variable" , what is it meaning by that? The scope is "Local" and it is within the same function. The variable was even referenced in the step right before the one throwing the error. Any insight would be thoroughly appreciated. Thank you!
    • satanico64
      By satanico64
      Hi guys ! nice to see you again !
      Here it is:
      In my scripts, i use several include files. (about 20).
      For debugs, i would like to use ConsoleWrite('(5) : Clic pour aller à la ligne.' & @crlf  )
      But it only jump in the file currently opened. ( i have about 10 au3 file opened in scite, and if i click, it jump to line 5 of the current one ).
      It would have be nice to ask: ConsoleWrite('(5,awesomefile.au3) : Clic pour aller à la ligne.' & @crlf  ). Or simply it would go to the line 5 of the script where the command was.
       
      Have you found a tip for that ?
       
      thanks !
      have fun
      \,,/  Nicolas  \,,/
    • BinaryBrother
      By BinaryBrother
      Here is my code. Adopted from a post UEZ made.
      _GenerateUID() Func _GenerateUID() Local $lReturn, $lDriveSerial,$lRandomSeed = "" Local $lChr[2] For $N = 1 To 32 $lChr[0] = Chr(Random(65, 90, 1)) ;A-Z $lChr[1] = Chr(Random(48, 57, 1)) ;0-9 $lRandomSeed &= $lChr[Random(0, 1, 1)] Next $lDriveSerial = DriveGetSerial(StringLeft(@WindowsDir, 3)) $lReturn = StringToBinary($lRandomSeed & $lDriveSerial) ConsoleWrite($lReturn) ;<--- Is printed as a String. ConsoleWrite(@CRLF & $lReturn & @CRLF) ;<--- Printed properly as Binary? Return $lReturn EndFunc ;==>_GenerateUID Output:
      --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop V9P03Y144OZW38YC80IW1IJXWH4003501486415223 0x5639503033593134344F5A57333859433830495731494A58574834303033353031343836343135323233 +>10:40:52 AutoIt3.exe ended.rc:0 +>10:40:52 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.544
      Whenever ConsoleWrite is fed pure binary, it will output it as a string. Whenever a string is mixed with the binary, it outputs the binary as binary.
      I found this especially confusing when I consulted the Help Documents for an answer...
       
      I'm sure I'm missing something, as usual. As always, thanks for your time!
    • javiwhite
      By javiwhite
      Hi All,
      I've been experimenting with the colour options for the SciTE script editor included with AutoIT's full installation, and seem to be having a bit of trouble achieving the colours I'm after....
      After reading the given documentation for ConsoleWrite (the function i'm trying to use), I can see that the default colours are chosen with the following parameters:
      ! = Red > = Blue - = Orange + = Green However, I'm receiving the following;

      As you can see, the output is still formatted with colours, Only they're not what I was expecting.
      I assume this is a setting in SciTE rather than the AutoIT language, Has anyone come across any settings within SciTE regarding console colouring? I've been through various properties and settings for SciTE. but can't seem to find anything that references console or colour.
      May sound like i'm grasping at straws a bit here, But I'm after formatting certain outputs with red text more than anything.
      Any help is greatly appreciated.
      Kind Regards
      Javi.