Skip to content
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

Parse newline #513

Closed
Yurii-Chaban opened this issue Feb 19, 2018 · 3 comments
Closed

Parse newline #513

Yurii-Chaban opened this issue Feb 19, 2018 · 3 comments

Comments

@Yurii-Chaban
Copy link

Yurii-Chaban commented Feb 19, 2018

Hi, i have a problem with parse json in editor in mode Code. When i add JSON and in some text field add a lot of new lines and save that and validator pass that and this is saved. When i got a saved json from beckend i try to parse saved json but got an error. I can't parse json becouse a lot of new lines broke JSON.parse()

On backend json encoded for special charsets and when i got json i decoded json for show normal text.

After i send json on backend i saw in request that \r or \n replaced to long free space.
For decode i use ('html-entities').AllHtmlEntities.
If i don't use decode i see a specials charset and i see a big space on place where i must see new row or new line.

image

Maybe something from Ace editor will help me with fixing this?

@josdejong
Copy link
Owner

Thanks for reporting @YuriyChaban . Can you post an example of the JSON document that gives issues, so I can try to reproduce? Does it also happen on https://jsoneditoronline.org?

For Ace to work correctly with special characters, you indeed have to specify UTF-8 encoding on your website and script, this issue also occurs with Chinese character sets (See for example #502).

@Yurii-Chaban
Copy link
Author

Hi @josdejong, sorry that I did not answer for so long, you can close this issue as I solved this problem. The problem was that when I decoded the encoding on the backend symbols \r and \n I received an error when parsing in the editor becouse i've got 
 as \r and 
 as \n and can;t decode this charsets until i replaced 
 to \r and 
 to \n

@josdejong
Copy link
Owner

👍

you can close the issue yourself too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants