cdeb Posted July 12, 2019 Share 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 Link to comment Share on other sites More sharing options...
Danp2 Posted July 12, 2019 Share 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 Link to comment Share on other sites More sharing options...
Malkey Posted July 14, 2019 Share 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) Earthshine, FrancescoDiMuro, tarretarretarre and 1 other 3 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted July 15, 2019 Share 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 Link to comment Share on other sites More sharing options...
cdeb Posted July 17, 2019 Author Share Posted July 17, 2019 Perfect! thank you very much Malkey 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