Ascend4nt Posted May 20, 2010 Share Posted May 20, 2010 (edited) Now there is another nice toy. Thank you. Thanks, but I realized I should have swapped the hex order so it can be directly transferred to a PCRE. Here's the fixed version: $sInputStr=InputBox("Unicode-Hex converter","Enter Unicode character(s) in box to see Hexadecimal equivalents","","",360,140) If $sInputStr<>"" Then MsgBox(0,"Hex equivalent","Original string:"&@CRLF&$sInputStr&@CRLF&"Hexadecimal equivalents (enter as \x## for values starting in 00, otherwise \x{####}):"&@CRLF& _ StringRegExpReplace(StringTrimLeft(StringToBinary($sInputStr,2),2),"(..)(..)","0x$2$1, ")) Edited May 20, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
jchd Posted May 21, 2010 Share Posted May 21, 2010 (edited) I didn't follow the thread completely and I apologize in advance if this is way off target.Anyway, here we go. I've transposed into AutoIt some functions I use for one of my SQLite extensions. This is the part where I deal with Unicode casing and unaccenting. I transposed it from C after "some" editing... Please don't look at the code, it's ugly because I didn't have enough time to change the structure of some tables and, to be fully honest, I've little incentive to do so right now.I believe the Unicode tries are correct as per Unicode v5.1, except for a small number of codepoints that I needed/whished to handle differently from the Unicode tables. The exceptions I introduced are few and I may miss some here. For instance, greek digamma Ϝ, ϝ are subject to casing, german Eszet ß and uppercase Eszet ẞ (U+1E9E) are handled in a special way, finally several symbols are expanded differently by the unaccenting function: fraction symbols use solidus [aka slash] instead of Unicode-recommended fraction bar, ™ gives TM, © gives (.C.) [without the dots!], ® gives (.R.) [without the dots!], all ligatures are expanded, and so on.Living out the gory details, the OP might well find the _UnicodeUnaccent($str) function handy to do [part of] the job.Short example (I leave it here so that the fancy characters will display nicely):Local $s = "éÔµ€kißjàIJçè™…é$énÑÞþÆвℝÅ⁉fiflӸӡӁຳИЙ¼Ϝ½ϝ¾¿ϳʩʪʫʭǽ©ª®ij" & ChrW(0x1E9E)_ConsoleWrite("_Lower = " & _UnicodeLower($s) & @LF)_ConsoleWrite("Lower = " & StringLower($s) & @LF & @LF)_ConsoleWrite("_Upper = " & _UnicodeUpper($s) & @LF)_ConsoleWrite("Upper = " & StringUpper($s) & @LF & @LF)_ConsoleWrite("_Title = " & _UnicodeTitle($s) & @LF & @LF)_ConsoleWrite("_Fold = " & _UnicodeFold($s) & @LF & @LF)_ConsoleWrite("_Unaccent = " & _UnicodeUnaccent($s) & @LF & @LF)produces:_Lower = éôµ€kißjàijçè™…é$énñþþæð²ℝå⁉fiflӹӡӂຳий¼ϝ½ϝ¾¿ϳʩʪʫʭǽ©ª®ijssLower = éôµ€kißjàijçè™…é$énñþþæð²ℝÅ⁉fiflӹӡӂຳий¼Ϝ½ϝ¾¿ϳʩʪʫʭǽ©ª®ijẞ_Upper = ÉÔΜ€KISSJÀIJÇÈ™…É$ÉNÑÞÞÆвℝÅ⁉fiflӸӠӁຳИЙ¼Ϝ½Ϝ¾¿ϳʩʪʫʭǼ©ª®IJẞUpper = ÉÔµ€KIßJÀIJÇÈ™…É$ÉNÑÞÞÆвℝÅ⁉fiflӸӠӁຳИЙ¼Ϝ½ϝ¾¿ϳʩʪʫʭǼ©ª®IJẞ_Title = ÉÔΜ€KISSJÀIJÇÈ™…É$ÉNÑÞÞÆвℝÅ⁉fiflӸӠӁຳИЙ¼Ϝ½Ϝ¾¿ϳʩʪʫʭǼ©ª®IJẞ_Fold = éôμ€kißjàijçè™…é$énñþþæð²ℝå⁉fiflӹӡӂຳий¼ϝ½ϝ¾¿ϳʩʪʫʭǽ©ª®ijß_Unaccent = eOμ€kissjaIJceTM...e$enNÞþAEÐ2RA!?fiflЫӡЖາИИ1/4Ϝ1/2ϝ3/4¿ϳʩʪʫʭae©a®ijSStesttries.au3Edit: posting this way was a bad idea: display is distorded, better try by yourself! Edited May 21, 2010 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 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...
GEOSoft Posted May 21, 2010 Share Posted May 21, 2010 I like this too. You people are just going hog wild building my repertoire of RegExp functions and I just know they are all going to come in handy. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
jchd Posted May 21, 2010 Share Posted May 21, 2010 (edited) I've taken some more time to read he heart of the thread. You guys are confusing ANSI and Unicode. For instance: $teststring = '123€ transformed by PCRE(™)' $teststring = StringRegExpReplace($teststring, "[\x{2122}]", "TM") $teststring = StringRegExpReplace($teststring, "[\x{20ac}]", "Euro") _consolewrite($teststring & @LF) works as expected if you lunch it from a UTF-8 + BOM encoded file. The code posted before was incorrect: 2122 is a hex value and \x99 is a control character in Unicode. In the same way, the range posted from \x80 to \x9F is a range of Unicode control characters, so there is little chance they match text. In short, there is no bug at all for me, or there is something big I miss. Edited May 21, 2010 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 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...
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