Newline problem when writing to HTML using JavaScript

后端 未结 4 2047
逝去的感伤
逝去的感伤 2021-01-21 14:03

I\'m using regular textbox as a text input where the users wrties their comments. I then use JQuery and JSON to send data to the server and then insert it into

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-21 14:39

    I beleive this is down to the encoding you are using. Difference between unicode and ascii or something similar. It's been a while since I worked on something like this but I think it boiled down to two options.

    1. match up the encoding on save and on load (we found that we had ascii on one and unicode on another).
    2. replace all new line character with an arbituary value when saving and swap it back when you load it.

提交回复
热议问题