> On 1 Jul 2017, at 9:57 PM, Marcus Märker <m.maer...@gmail.com> wrote:
> 
>  
> As a general rule, you should not just use str() to convert bytes to a 
> unicode string. This is because it will use the default system encoding, 
> which may not be want you want.
> 
> You should at least use:
> 
>     data.decode('UTF-8')
> 
> I would though suggest you look up how to have Flask understand you are 
> returning bytes, as the conversion to unicode is unnecessary as Flask will 
> have to convert it back to bytes anyway.
> 
> I'll keep that in mind, thanks. However, this is not the actual issue. The 
> example is constructed for this post. I just wanted to return something.
>  
> This is also an old and out of date mod_wsgi version. I would recommend you 
> update to the latest. Ubuntu does not support the mod_wsgi packages they ship 
> and I can't help you with such an out of date version if there are problems 
> with it.
> 
> OK, I just compiled and installed the current version so that I'm now running 
> Apache/2.4.18 (Ubuntu) mod_wsgi/4.5.15 Python/3.5.
> 
> The actual problem are the bytes I get from the request
> b'{"text":"test 123 \\xc3\\xa4\\xc3\\xb6\\xc3\\xbc"}'
> instead of
> b'{"text":"test 123 \xc3\xa4\xc3\xb6\xc3\xbc"}'

Write it to a distinct file, not to the Apache error log via sys.stdout or 
Python logging module.

When non ASCII characters get displayed in the Apache error log, it can do 
strange escaping things when displaying them. You cannot therefore trust what 
it shows you.

So write to a separate file so you can control ability to write the raw data. 
Then check what you get and see if it is different.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to