-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with InternalRender #49
Comments
It seems to be the correct bahaviour. TJSONValue.ToString is not intended to produce correct JSON but only for debug purpouse . |
I have attached an example. I believe the problem lies in converting UTF-8 in RESTClient. To simulate. Run the server. Open Client and click Execute. Special characters are not converted. |
Hi Ezequiel, the "garbage" you see is the JSON encoded string. You have to parse that P.S. Did you have some tested code to implement output compression in See you DT 2016-09-12 19:49 GMT+02:00 Ezequiel Juliano Müller <notifications@github.com
Daniele Teti |
In unit MVCFramework.pas exists the following method:
When an exception is raised on my server (the error message contains special characters) the line
JString := aJSONValue.ToJSON;
(My case I'm with X7) It is not right encoding the message.If I use
JString := aJSONValue.ToString;
The conversion is done correctly.For example. The following error message is generated on the server:
'{"status":"error","classname":"EACBrNFeException","message":"Falha na validação dos dados da nota: 0'#$D#$A'TAG: ID:B04/natOp(Descrição da Natureza da Operação) - Nenhum valor informado.'#$D#$A'TAG: ID:B12/cMunFG(Código do Município FG) - Conteúdo inválido.'#$D#$A'TAG: ID:B04/natOp(Descrição da Natureza da Operação) - Nenhum valor informado.'#$D#$A'TAG: ID:B12/cMunFG(Código do Município FG) - Conteúdo inválido.'#$D#$A#$D#$A''''' violates pattern constraint of ''[!-ÿ]{1}[ -ÿ]{0,}[!-ÿ]{1}|[!-ÿ]{1}''.'#$D#$A'The element ''{http://www.portalfiscal.inf.br/nfe}natOp'' with value '''' failed to parse.'#$D#$A'","http_error":417}'
When the system crashes in the
JString := aJSONValue.ToJSON;
message is like:'{"status":"error","classname":"EACBrNFeException","message":"Falha na valida\u00E7\u00E3o dos dados da nota: 0\r\nTAG: ID:B04/natOp(Descri\u00E7\u00E3o da Natureza da Opera\u00E7\u00E3o) - Nenhum valor informado.\r\nTAG: ID:B12/cMunFG(C\u00F3digo do Munic\u00EDpio FG) - Conte\u00FAdo inv\u00E1lido.\r\nTAG: ID:B04/natOp(Descri\u00E7\u00E3o da Natureza da Opera\u00E7\u00E3o) - Nenhum valor informado.\r\nTAG: ID:B12/cMunFG(C\u00F3digo do Munic\u00EDpio FG) - Conte\u00FAdo inv\u00E1lido.\r\n\r\n'''' violates pattern constraint of ''[!-\u00FF]{1}[ -\u00FF]{0,}[!-\u00FF]{1}|[!-\u00FF]{1}''.\r\nThe element ''{http://www.portalfiscal.inf.br/nfe}natOp'' with value '''' failed to parse.\r\n","http_error":417}'
If I leave the only
JString := aJSONValue.ToString;
the client receives the message correctly.My question is whether this compilation directive is really necessary. I would not to leave only
JString := aJSONValue.ToString;
The text was updated successfully, but these errors were encountered: