Re: MultiPartFormDataStream encoding problem

Giganews Newsgroups
Subject: Re: MultiPartFormDataStream encoding problem
Posted by:  Remy Lebeau (re…@lebeausoftware.org)
Date: Tue, 16 Oct 2012

Alexandre wrote:

> I'm doing something like this:
> MultiPartFormDataStream.AddFormField('message','zé');

You are sending a non-ASCII character, so you have to specify a charset for
it.  If you do not, Indy's default Ansi encoding will be used instead, which
is ASCII.

> In my http analyzer the characters are displayed in this way: message:
> z=E9 (so the accents are not displayed correctly)

Since you did not specify a charset, the character was lost when re-encoded
to ASCII.

> When I send the form by webbrowser the characters are displayed in my
> http analyser this way:
> message:  zé (so the accents are displayed correctly)

The character was encoded using the UTF-8 charset.

> Some ideia how to make it work properly ?

Change this:

MultiPartFormDataStream.AddFormField('message','zé');

To this:

MultiPartFormDataStream.AddFormField('message', 'zé', 'utf-8');

--
Remy Lebeau (Indy Team)

Replies

In response to

MultiPartFormDataStream encoding problem posted by Alexandre on Tue, 16 Oct 2012