Encoding UTF8, accents

Hi!
I’m facing Accents issue.

I configured the HttpsecureSocket, in fact I have 60 HTTPSecuresockets, each socket its configured as this way:

sock.Secure = True 
sock.Port = 443    
sock.ConnectionType = SSLSocket.SSLv23  
sock.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") 
sock.SetRequestHeader("Accept-Encoding:","gzip,deflate,sdch") 
sock.SetRequestHeader("Host", "cfdicontribuyentes.accesscontrol.windows.net")
sock.SetRequestHeader("Referer:","https://cfdiau.sat.gob.mx/nidp/wsfed/ep?id=SATx509Custom&sid=0&option=credential&sid=0")
sock.SetRequestHeader("User-Agent:","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36")
sock.SetRequestHeader("Connection", "keep-alive")
sock.SetRequestHeader("Accept-Language", "es;q=0.8")
sock.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
sock.SetRequestHeader("Cookie", CookieName) 

Each socket has a DownloadSocket method that catches the DownloadComplete AddEventHandler of each Socket.

I use TidyXML to polish the XML, and a TextInputStream that also I configures the DefineEncoding(Encondigs.UTF8)

But despite of it, always I facing issues with accents like this:

?° instead of a
?â instead of é
?? instead of I
?? instead of o
?ì instead of o
? instead of o
?± instead of ñi

What am I doing wrong, Do I missing something?

Maybe this?

sock.SetRequestHeader("Accept-Language", "es;q=0.8") sock.SetRequestHeader("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
or

sock.SetRequestHeader("Content-Type" content="text/html; charset=UTF-8" )

HTTPSecureSocket gets a bucket of bytes.

Use a defineencoding to make it an UTF-8 string.

[quote=392627:@Loannis Kolliageorgas]Maybe this?

sock.SetRequestHeader("Accept-Language", "es;q=0.8") sock.SetRequestHeader("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
or

sock.SetRequestHeader("Content-Type" content="text/html; charset=UTF-8" )

Nope, in other apps, it works me ok, even the other way that I’ve posted before.

But that appears a devil artifact!
I done this, I lave used DefineEncoding UTF8, ConvertEncoding UTF8, Eveng replacing the weird characters.

But the most curious/funny thing is that when I use Replace, for replace any Other character or phrase inside the downloaded XML, It replace it, example.

Dim strDumpXML As String

strDumplXML = blablablablablablablablah

strDumpXML = strDumpXML.ReplaceAll(“blah”,“LordVoldemort”)

and it does: strDumplXML = blablablablablablablaLordVoldemort

But the I tried to to replace the weird characters it ignores it!

What is the encoding declaration at the top of the xml text?

Is it “<?xml version="1.0" encoding="UTF-8"?>” or something else?

[quote=392674:@James Meyer]What is the encoding declaration at the top of the xml text?

Is it “<?xml version="1.0" encoding="UTF-8"?>” or something else?[/quote]
Yes its <?xml version="1.0" encoding="UTF-8"?>

Regards

the source is "https://cfdiau.sat.gob.mx" ? I ask because the response from this server is
Content-Type => text/html;charset=ISO-8859-1

and in the sock.SetRequestHeader("Accept-Language", "es;q=0.8")
to

sock.SetRequestHeader("Accept-Language"en, "es;q=0.8")

or

sock.SetRequestHeader("Accept-Language" *, "es;q=0.8")

But if I do this, It gives me a Syntax Error:
HTTPSecureSocket.SetRequestHeader(name as String, value as String)

[quote=392719:@Gerardo García]But if I do this, It gives me a Syntax Error:
HTTPSecureSocket.SetRequestHeader(name as String, value as String)[/quote]

my mistake


http://i65.tinypic.com/343luo5.jpg

Gerardo, could you upload a simple demo project showing the problem?

I found the issue, The request header was ok, even with the original parameters, the Issue was on MBS’s Tiny Plugin.
:smiley:

But besides I used @Loannis Kolliageorgas parameters for request Headers