[Gambas-user] Converting a POST string

Rolf-Werner Eilert eilert-sprachen at ...221...
Fri Jul 19 19:10:03 CEST 2013



Am 19.07.2013 18:49, schrieb Benoît Minisini:
> Le 19/07/2013 18:27, Rolf-Werner Eilert a écrit :
>>
>>
>> Am 19.07.2013 18:02, schrieb Benoît Minisini:
>>> Le 19/07/2013 17:43, Rolf-Werner Eilert a écrit :
>>>> Hi,
>>>>
>>>> just bounced into this: When doing a POST request on a web form, the
>>>> string input by the user is encoded in UTF-8 but as %high-byte%lowbyte
>>>> such as "%C3%BC" for "ü".
>>>>
>>>> How do I reconvert these worms to UTF-8 strings? Tried conv(), but
>>>> didn't succeed yet. Is there a quick way, or do I have to pick out all %
>>>> and convert them one-by-one?
>>>>
>>>> Thanks for your help.
>>>>
>>>> Rolf
>>>>
>>>
>>> One by one. Or fix your HTTP client!
>>>
>>
>> Err - you mean the server? Apache configuration?
>>
>
> If bytes are swapped in the client request, then the client is buggy.
> UTF-8 is low byte first.
>

Aah ok, we got us wrong here. It's the %something thing which isn't 
converted back into a Gambas UTF-8 string. It is not a problem about low 
or high byte first, that was a mistake I made when writing the mail.

When I read the POST string in, I get for example %C3%BC for "ü", so I 
have to convert these into UTF-8 characters for the string within Gambas 
to process them further.

My question should have been: Is there a ready-made function like conv() 
that is able to receive a 7-bit string in the form of %C3%BC and will 
convert it into a string with an ü?

And if conv() will do, which types of encoding will I have to use here?

Regards
Rolf




More information about the User mailing list