probably not a web2py issue but may be someone can help:
I have a string field containing the string 'TØM', all works fine in pure
web2py.
When I try to read it dynamically with ajax I get the string 'T\xc3\x98ST'
The ajax call is as following:
$.ajax({
type: "POST",
url: "/shop/ajax_get_products/"+$('#cust_type').val(),
success: function (msg) {
//console.log(msg)
/* Remove all options from the select list */
$("#product_list").empty();
if(msg=="[]"){
$("#product_price").text({{=T("'Selected customer type has no
products'")}});
return;
}
$("#product_list").html(msg);
return;
},
error: function(jqXHR, exception){
console.log(exception)
}e...
The web2py function that returns the data :
products=db((db.shop_price.cust_type==request.args[0])&(db.shop_product.id==db.shop_price.product)&(db.shop_product.enable==True)).select()
opts=[OPTION(prod.shop_product.name,_value=str(prod.shop_product.id)).xml() for
prod in products]
return XML(opts)
I get a fine list of names in the browser except the string 'TØM' that is
shown as 'T\xc3\x98ST'
I tried encoding/decoding the name in the option generator above but got a
python error.
I tried:
opts=[OPTION(prod.shop_product.name.encod('utf-8'),_value=str(prod.shop_product.id)).xml()
for prod in products]
Also tried adding to the ajax call:
dataType : "html",
contentType: "application/json; charset=utf-8",
same results
Thanks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.