Error with Latin characters

I have a rather annoying problem:

I am using Node.js for this.
In the DB i have a restaurant which has non Latin characters in it (é á ñ). I need to update an order and have to bring the related restaurant with it (autoload). So i query BE for the order, change a field and try to save it back (update) but then the API wont’s save the updated object back to BE saying “Could not parse request with message: Invalid Json”.

If i remove the non-latin characters from the restaurant fields directly in the DB before querying then BE saves successfully. However for restaurant names this is clearly unacceptable. I don’t need to update the restaurant in any way, but i cannot not sending it either as this will unlink the restaurant to the order.

By the way, im getting invalid gateway error when i try to post here in the forums

Can you post a sample REST request that’s giving you an error?

I am using the JS api yet.

Here is a raw response from the api when saving.

{“COSTO”:7700,“ID_PEDIDO”:2184,“ID_ESTADO”:null,“PARA_LLEVA
R”:false,“ownerId”:“BB4389B6-EA35-9AA6-FF88-A1F053763200”,“ESTADO_PEDIDO”:“IMPRESO”,
“CODIGO_CONFIRMACION”:“NFGSD-23U”,“HORA_ENTREGA”:0,“ID_CLIENTE”:null,"__class":“Ped
ido”,“REFERENCIA”:null,“created”:1430240088000,“PRODUCTOS_PEDIDO”:"23507;23509;23510
",“updated”:1430313982000,“objectId”:“F56D2E24-C73C-8799-FFF1-7E829CF82500”,"NOMBRE

CLIENTE":“Nicolas Zapata”,“HORA_PEDIDO”:1430240051000,“ID_SUCURSAL”:{“NOMBRE”:“Crocc
ante”,“HORA_APERTURA”:“0,0,0”,“ownerId”:null,“TIEMPO_ENTREGA”:12,“ZONA”:null,“TELEFO
NO”:“319 2346788”,"___class":“Sucursal”,“DIRECCION”:“Cra 1 # 20 A - 37. En la calle
de Doña Blanca”,“VERSION”:0,“created”:1427903690000,“updated”:1430240813000,“PASARE
LA”:“PAYU”,“objectId”:“02314F75-E178-A3B9-FF2C-83C0B7DA8200”,“INFO_DISPLAY”:“Disfrut
a el mejor Gelato, Cafés especiales de Exportación, y arma tu Panino como siempre
te lo has imaginado!”,“ID_SUCURSAL”:23001,“HORA_CIERRE”:“1440,1440,1440”},“ID_PAGO”:
null,“NOMBRE_PRODUCTOS”:"",“COMENTARIOS_ADICIONALES”:“Al clima por favor”}
pedido guardado: {"___class":“Pedido”,“REFERENCIA”:"",“ID_PEDIDO”:-1,“PARA_LLEVAR”:f
alse,“COSTO”:-1,“PRODUCTOS_PEDIDO”:"",“NOMBRE_CLIENTE”:"",“ownerId”:"",“ESTADO_PEDID
O”:"",“updated”:“2015-04-29T15:19:41.907Z”,“ID_ESTADO”:"",“COMENTARIOS_ADICIONALES”:
“”,“HORA_PEDIDO”:“2015-04-29T15:19:41.907Z”,“CODIGO_CONFIRMACION”:"",“created”:“2015
-04-29T15:19:41.907Z”,“NOMBRE_PRODUCTOS”:"",“HORA_ENTREGA”:"2015-04-29T15:19:41.907Z
",“ID_SUCURSAL”:null,“ID_PAGO”:null,“ID_CLIENTE”:null,“message”:“Could not parse req
uest with message: Invalid Json”,“code”:8002}

removing the Latin carachters solves the problem.

Is it possible to see what you’re sending in the request?

Not really. The ajax calls in Backendless.js do not have a way to print the request and the debugging tools do not allow me to see the outgoing traffic.

In order for us to fix a problem we need to be able to reproduce it first. It is much harder to reproduce it by seeing server response. We really need to see WHAT you’re sending. Either sample code or the actual message would help.

Alright. I tried to capture https packets outside Node.js, but, well, they are encrypted.

Here is the code i use to query and save from nodejs. Nothing fancy. Just a find call and a save call.

var listaPedidos = Backendless.Persistence.of(Pedido);
	var dataQueryPedidos = {condition: "ID_PEDIDO = 2184" };
	listaPedidos.find(dataQueryPedidos, new Backendless.Async(procesarPedido, error));

 function procesarPedido(respuestaRaw) 
 {	
 var pedidoSolicitado = respuestaRaw.data[0];

 Backendless.Persistence.of(Pedido).save(pedidoSolicitado, new Backendless.Async(function(x)
			{
 console.log(x);
 }
}

I’d suggest to reproduce this error simply retrieve an object with latin caracheters on it or with a related object which has latin characters on it and then try to save that very object.

Hi!

Has there been any changes in this ticket?

Nicolas

We’re still looking into it. Quick question: how did you save an object with Latin characters in the first place? Or did you create it in console?

Mark

Console. And usesr can register their names and cities with non latin carachters as well (Bogotá)

Hi, Nicolas,
The issue has been fixed in JS SDK, I’ve attached the latest version to this comment. The SDK on our website will also be updated soon.
Regards,
Sergey

backendless-js-sdk.zip (1.83MB)

Thank you very much Sergey,
I’ll put it in production tomorrow.

Best regards,

Nicolas.