[python-win32] Python/ASP Request data with non ascii characters

Emlyn Jones emlynj at gmail.com
Mon Jul 3 11:50:16 CEST 2006


On 7/1/06, Mark Hammond <mhammond at skippinet.com.au> wrote:
> > I thought I would be able to do
> >
> > my_string = unicode(Request("formstring"),"ISO-8859-1")> >
> > But i get:
> > coercing to Unicode: need string or buffer, instance found.
> > I'm guessing (and I mean guessing) this is because the CDispatch
> > object doesn't have a __unicode__ function.
>
> A __unicode__ function may well help there - but alternatively, you should
> find that something like Request("formstring").Value (or similar) will give
> you the unicode string.  I'm afraid I can't recall exactly what the Request
> method returns in that case, so .Value is a guess...
>
> Cheers,
>
> Mark
>
>
Hi Mark, thanks for the reply. The attribute you where thinking off is `Item`.
What I'll need to work out now is which code page has been used to
encode that Unicode string. Possibly the wrong list for this question,
but does anybody know if it is likely to of used the code page of the
client browser or the default system code page of the server? Is there
a way for me to find the code page from the object?

Cheers,
Emlyn.


More information about the Python-win32 mailing list