I think urlencoding is the problem.

If I run 
http://example.com/cont/func?var=š<http://example.com/cont/func?var=%C5%A1>

it encodes into

http://example.com/cont/func?var=%9A

if I define controller-function
def func:
    return request.vars.var

I get the symbol � as output

However - return 'š' in function makes symbol š as output (just testing)

That's why I GUESS jquery-json is not the problem - urlencoding is.
I cannot make POST request because I use cross-domain calls for submiting
data.


I'm not sure if that's the only problem here, but...

How to translate it back to symbol 'š' (not hardcoding it, there are many
simbols that needs to be fixed)?

On Wed, Jan 26, 2011 at 9:49 PM, Niphlod <niph...@gmail.com> wrote:

> did you look into http://code.google.com/p/jquery-json/issues/detail?id=43
> ?
>
> json.loads in web2py fits well with unicode .... maybe it's jquery-
> json and browser implementation that screws something up.
>
> On 26 Gen, 20:51, Marin Pranjic <marin.pran...@gmail.com> wrote:
> > It's not web2py related, but I hope someone can help me.
> >
> > I'm sending data via ajax, which is urlencoded JSON object (I used
> > jquery-json).
> > Then, I use json.loads(variable) to load the object.
> >
> > Everything works good for normal ASCII characters, but if I send non-
> > ascii chars, i get the following:
> >
> > UnicodeDecodeError: 'utf8' codec can't decode byte 0x9a in position 2:
> > invalid start byte
> >
> > I need to write data into database, and replacing non-ascii with some
> > ascii chars is not an option, i need exact match.
> >
> > Hope you understand... :)
>

Reply via email to