« Risposta #1 il: 07 Novembre 2014, 15:39:15 »
...continua...
"
Hi Benoît (it is always a pleasure to read you in mailing list)
we have eg 3 cases:
1°->
"Content-Type: text/plain; charset="iso-8859-1"
print hpart.ContentType
output-> "text/plain"
print hpart.Header["Content-type"]
output-> text/plain; charset="iso-8859-1"
2°->
"Content-Type: text/plain; charset=windows-1252; format=flowed"
print hpart.ContentType
output-> "text/plain"
print hpart.Header["Content-type"]
output-> "text/plain; charset=windows-1252; format=flowed"
3°->
->Content-Type: text/plain;
charset="UTF-8" <-
print hpart.ContentType
output-> "text/plain"
print hpart.Header["Content-type"]
output-> text/plain; charset="UTF-8"
I found the following solution that seems to work, waiting for your
review with the possibility of using hpart.charset s = hPart.Headers["content-type"]
If InStr(s, "charset") > 0 Then
s = Mid(s, InStr(s, "charset=") + 8)
s = Left(s, InStr(s & " ", " "))
s = Replace(s, ";", "")
s = Trim(Replace(s, Chr(34), ""))
Try s = Conv(hPart.Data, s, "utf-8")
If Error Then Message.Error("errore nel decodificare una parte mime " & Error.text, "ok")
Return
Else
Return hpart.Data
Endif
Regards
Roberto "
"
I didn't realize that the charset was stripped by the ContentType
property, because this property is a direct interface to the gmime library.
Maybe I will add a "Charset" method that extract the optional charset
part for you.
Regards,
--
Benoît Minisini "
« Ultima modifica: 07 Novembre 2014, 19:22:34 da vuott »
Registrato
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »