Jump to content

Help conver string from Uni to Character


Recommended Posts

1 hour ago, ngocthang26 said:

Original text :

?q=Kim+lo%E1%BA%A1i

Converted :

?q=Kim+loại

 

Try this :

Global $sOrig, $sConv
$sOrig = "?q=Kim+lo%E1%BA%A1i"
$sConv = _Decode($sOrig)
MsgBox(BitOR(4096,64), "Conversion :", "Original  " & $sOrig & @CRLF & "Converted  " & $sConv)

Func _Decode($sData)
    Local $aData = StringSplit($sData,"%")
    $sData = ""
    For $i = 2 To $aData[0]
        $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2)
    Next
    Return BinaryToString(StringToBinary($aData[1],1),4)
EndFunc

@ngocthang26

EDIT : Show result in a MsgBox (not as ConsoleWrites)

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

2 hours ago, Musashi said:

Try this :

Global $sOrig, $sConv
$sOrig = "?q=Kim+lo%E1%BA%A1i"
$sConv = _Decode($sOrig)
MsgBox(BitOR(4096,64), "Conversion :", "Original  " & $sOrig & @CRLF & "Converted  " & $sConv)

Func _Decode($sData)
    Local $aData = StringSplit($sData,"%")
    $sData = ""
    For $i = 2 To $aData[0]
        $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2)
    Next
    Return BinaryToString(StringToBinary($aData[1],1),4)
EndFunc

@ngocthang26

EDIT : Show result in a MsgBox (not as ConsoleWrites)

Working. Thanks you so much. ❤️ 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...