将4位unicode转义转换为实际符号

时间:2014-07-30 03:02:03

标签: autoit

如何将4位unicode转义序列转换为AutoIt中的实际符号 例如"\u00a5" to "¥"

1 个答案:

答案 0 :(得分:4)

你是说这个?

    #include <MsgBoxConstants.au3>

Local $sText = ""
For $i = 256 To 2048
    $sText = $sText & ChrW($i) ; Or $sText &= ChrW($i) can be used as well.
Next
MsgBox($MB_SYSTEMMODAL, "Unicode chars 256 to 2048", $sText) ; Display the unicode characters between 256 to 2048.

或者:Special chars in Autoit

或者这个:?

#include <WinAPI.au3>
Local $str = "My name is \u00a5"
Local $utfStr = Execute("'" & StringRegExpReplace($str, "(\\u([[:xdigit:]]{4}))", "' & ChrW(0x$2) & '") & "'")
Local $ansiStr = _WinAPI_WideCharToMultiByte($utfStr)
MsgBox(64, "Unicode2Ansi", $utfStr & @CRLF & $ansiStr)
Exit