kylomas Posted January 21, 2015 Share Posted January 21, 2015 Given the following array $aFL = ['File50','File10','File12','File38','File00100','File001'] My understanding up till now is that each element is an ASCII string. How do I make them unicode? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
BrewManNH Posted January 21, 2015 Share Posted January 21, 2015 You can put unicode strings into arrays just be using Unicode characters. Global $aArray[1] = ["באָבקעס מיט קודוצ׳ה"] MsgBox(0, "", "$aArray = " & $aArray[0] & @CRLF) You have to make sure the encoding in SciTE is set to one of the UTF options, File => Encoding => UTF8 with BOM works for the above code. You should see the same text in the message box as you do in SciTE. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Solution jdelaney Posted January 21, 2015 Solution Share Posted January 21, 2015 (edited) ? #include <Array.au3> Local $aFL[6] = ['File50','File10','File12','File38','File00100','File001'] For $i = 0 To UBound($aFL)-1 Local $aTemp = StringToASCIIArray($aFL[$i]) $aFL[$i] = _ArrayToString($aTemp,"") Next _ArrayDisplay($aFL) Return valud from StringToASCIIArray: Success: An array where each element is the UNICODE code of the character at the corresponding position. Failure: Returns an empty string. Taking your other post into consideration: #include <Array.au3> Local $aFL[6] = ['File50','File10','File12','File38','File00100','File001'] For $i = 0 To UBound($aFL)-1 Local $aTemp = StringToASCIIArray($aFL[$i]) For $j = 0 To UBound($aTemp)-1 $aTemp[$j]=StringFormat("%03s",$aTemp[$j]) Next $aFL[$i] = _ArrayToString($aTemp,"") Next _ArrayDisplay($aFL) _ArraySort($aFL) For $i = 0 To UBound($aFL)-1 $aTemp = StringRegExp($aFL[$i],"\d{3}",3) $aFL[$i] = StringFromASCIIArray($aTemp) Next _ArrayDisplay($aFL) Edited January 21, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
kylomas Posted January 21, 2015 Author Share Posted January 21, 2015 Thanks, never used that function but will have to keep it in mind. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
jchd Posted January 22, 2015 Share Posted January 22, 2015 Given the following array $aFL = ['File50','File10','File12','File38','File00100','File001'] My understanding up till now is that each element is an ASCII string. How do I make them unicode? You don't have to do anything: all native AutoIt strings are stored and processed as UCS-2 (roughly = Unicode plane 0) i.e. every character in a string is represented by a single 16-bit Unicode codepoint. As BrewManNH said, you obviously need to set source file encoding to UTF8+BOM to represent characters outside your active codepage. When not using UTF encoding, extended ASCII characters (in [0x80..0xFF]) in the source file are subject to interpretation under the currently active codepage. That means that if you expect source portability accross users using different codepages, you need to use UTF encoding. But whatever encoding is used in the source, the compiled executable will be portable*, since string literals are stored in UCS encoding inside the .EXE. * but only if you don't use Chr(value) with value > 0x7F. OTOH ChrW(value) will be portable. Also basic ConsoleWrite output is codepage dependent. Using CP 65001 as default codepage (switch console to Unicode) restores the portability. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
kylomas Posted January 22, 2015 Author Share Posted January 22, 2015 Thanks, jchd, my question was related to this >thread. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now