1 Attachment(s)
HOW to decode this string in ascii code
i just have decoded only:
\u00E8="è"
...
\u00E8
\u00E0
\u0027A
\u0027O
\u00F9
\u00E9r
\u00E8r
\u00E9
\u00C8t
\u00F4n
\u00E7a
\u00E9
\u00EAm
\u00E9m
\u00E8s
\u0027
\u00F2
\u00EC
\u00E8y
\u0027E
\u0027I
\u00F9
\u00E0
...
in other case i use this code to return value:
...
URL = "https://situas-servizi.istat.it/publish/reportspooljson?pfun=51&pdata=17/03/1861"
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "GET", URL, False
xmlhttp.send
STRINGA= xmlhttp.responseText
Dim F As Integer
F = FreeFile
Open "C:\TABULATI\ISTAT_COMUNI.txt" For Output As #F
Print #F, STRINGA
Close #F
...
For AN idea see the First comune Is Agliè... In txt file
Re: HOW to decode this string in ascii code
These mapping are escaped Unicoded characters.
You can not simply map these to ANSI
Re: HOW to decode this string in ascii code
Try this code:
Code:
Sub RemplacerCode()
Dim Source As String
Dim Destination As String
Dim nFile As Integer
Dim content As String
Dim segments() As String
Dim i As Long
Dim Hexa As String
Dim resultat As String
Source = "C:\Users\pc\Downloads\ISTAT_COMUNI\ISTAT_COMUNI.txt"
Destination = "C:\Users\pc\Downloads\ISTAT_COMUNI\ISTAT_COMUNI 2.txt"
nFile = FreeFile
Open Source For Input As #nFile
content = Input(LOF(nFile), #nFile)
Close #nFile
segments = Split(content, "\u00")
For i = 1 To UBound(segments)
Hexa = Left$(segments(i), 2) '
segments(i) = Chr$(Val("&H" & Hexa)) & Mid$(segments(i), 3)
Next
resultat = Join(segments, "")
nFile = FreeFile
Open Destination For Output As #nFile
Print #nFile, resultat;
Close #nFile
MsgBox "Finish"
End Sub
Re: HOW to decode this string in ascii code
Quote:
Originally Posted by
anycoder
Try this code:
Code:
Sub RemplacerCode()
Dim Source As String
Dim Destination As String
Dim nFile As Integer
Dim content As String
Dim segments() As String
Dim i As Long
Dim Hexa As String
Dim resultat As String
Source = "C:\Users\pc\Downloads\ISTAT_COMUNI\ISTAT_COMUNI.txt"
Destination = "C:\Users\pc\Downloads\ISTAT_COMUNI\ISTAT_COMUNI 2.txt"
nFile = FreeFile
Open Source For Input As #nFile
content = Input(LOF(nFile), #nFile)
Close #nFile
segments = Split(content, "\u00")
For i = 1 To UBound(segments)
Hexa = Left$(segments(i), 2) '
segments(i) = Chr$(Val("&H" & Hexa)) & Mid$(segments(i), 3)
Next
resultat = Join(segments, "")
nFile = FreeFile
Open Destination For Output As #nFile
Print #nFile, resultat;
Close #nFile
MsgBox "Finish"
End Sub
GREAT!
tks bro, work!!!!!!
2 Attachment(s)
Re: HOW to decode this string in ascii code
You may try vbman asynchronous download and convert json objects. You can use it freely. The compressed package contains the way to obtain vbman and more sample codes. It is open source and free.