문제

I want to store in a SQL Server database a note of a user. Sometimes they are using characters like €. But when the note is shown on the page you see this: "â, .┐ ".

function MyFunction(){
  var sNote = $("#usernote").val();
  ...
}

How can you keep the right character in the database?

도움이 되었습니까?

해결책

If you still want to stick to Windows-1252 encoding, you could map commonly used special characters like the Euro Sign etc. to HTML Entities for Output on the screen.

Input form data that might contain those characters you might have treated as Unicode input though, depending on what kind of special characters you want to be able to handle...

However many of the typical characters like € or ä, ß are still readable via single byte, if you assume a specific ascii code page.

Here is a character table that shows the differences between DOS CP-437 (US), DOS CP-850 (GERMAN) and WIN-1252 plus the HTML entity equivalents (ASCII Code Table Map), which you should always use for HTML output, like I just did in this comment.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top