Saturday, 7 January 2017
javascript - Weird characters are outputted using UTF-8
Answer
Answer
I am using code igniter framework and added the header("Content-Type: text/html; charset=UTF-8"); in server side as well as the < meta charset="UTF-8">,
< meta http-equiv="Content-type" content="text/html; charset=UTF-8"> in client side code.
When I type a french character with accent as input it keeps saving as weird characters like copyright symbol and weird A's. Im using javascript to encode the input and it encodes correctly into & #224; etc. but when I try decoding it with innerHTML it doesnt output the correct characters.
Answer
Thanks for your answers I found the issue, it was because I was not passing 'UTF-8' as a parameter while calling htmlentities() in php code. there was no need for me to try to encode it in javascript.
c++ - Does curly brackets matter for empty constructor?
Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...
-
A fair amount of the second act of The Dark Knight Rises has a class warfare plotline. This is foreshadowed in the trailers with Selina Ky...
-
I want to create an options array from a string. How can i create an array as { width : 100, height : 200 } from a string ...
-
This is my first post. I have searched extensively for four days through Stackoverflow and other sources for the problem and have yet to fi...
No comments:
Post a Comment