cdeb Posted July 12, 2019 Posted July 12, 2019 I have to convert strings with special characters to unicode escape sequences, how can I do? Example: input: questa è una provaoutput: questa \u00e8 una prova
Danp2 Posted July 12, 2019 Posted July 12, 2019 Try searching the forum for "alnum". That should give you multiple threads to review. Latest Webdriver UDF Release Webdriver Wiki FAQs
Malkey Posted July 14, 2019 Posted July 14, 2019 Try this. Local $sInput = "questa è una prova" Local $sOutput = Execute(StringRegExpReplace($sInput, '(.)', '(AscW("$1")>127?"\\u"&StringLower(Hex(AscW("$1"),4)):"$1")&') & "''") MsgBox(0, "Result", "input: " & $sInput & @CRLF & "output: " & $sOutput & @CRLF) tarretarretarre, FrancescoDiMuro, pixelsearch and 1 other 3 1
pixelsearch Posted July 15, 2019 Posted July 15, 2019 (edited) Hi all, Thanks Malkey for the interesting solution using SRER. It took me a moment to understand the end of your $Output line ==> &') & "''") <== so I would like to share its meaning with our readers Malkey used an interesting Replace pattern, based on the Ternary function, as shown in this image : Each ampersand (&) is literally included in the updated string resulting from SRER, between the Ternary functions. As there is a final ampersand (circled in red), that's why he added "''" at the end of the string, so the Execute function won't generate an error when executed. Well done ! Edited July 15, 2019 by pixelsearch FrancescoDiMuro 1
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