TIdHttpServer : envoyer de l'unicode
Bonjour,
j'ai une petite application qui retourne dynamiquement une petite page html. Elle a été faite avec un TIdHTTPServer. Aujourd'hui on souhaiterai traduire la page notament en Chinois (mais pas que). Et là ça coince. Nous sommes en Delphi XE2.
Donc si je code ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| aResponseInfo.CharSet := 'utf-8';
aResponseInfo.ContentType := 'text/html';
wDoc := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
+ '<html>'
+ '<HEAD><meta http-equiv="Content-Type" content="text/html; charset=utf8">'
+ '</head>'
+ '<body>'
+ '适用于电动车辆的高性能驱动电动机'
+ '</body>'
+ '</html>';
AResponseInfo.ContentText := wDoc; |
*la chaine est en unicode dans mon source, pas en caractères html comme elle apparait ici.
dans le navigateur on obtien des ?????
si je code ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| aResponseInfo.CharSet := 'utf-8';
aResponseInfo.ContentType := 'text/html';
wDoc := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
+ '<html>'
+ '<HEAD><meta http-equiv="Content-Type" content="text/html; charset=utf8">'
+ '</head>'
+ '<body>'
+ UTF8Encode( '适用于电动车辆的高性能驱动电动机')
+ '</body>'
+ '</html>';
AResponseInfo.ContentText := wDoc; |
Dans le navigateur on obtien la traduciton utf8
Suite à des recherche sur internet, j'ai également essayé dans le OnConnect de mettre ceci :
Code:
AContext.Connection.IOHandler.DefStringEncoding := TEncoding.Default;
aucun effet :(
Est-ce que quulqu'un qui s'y connait bien en encodage pourrait m'éclairer un petit peu ?
Merci de votre attention.
@++
Dany