When I am parsing a string to become a JSON object there are some special characters that are replaced with the black question mark (�), I believe that is an issue with the encoding of the character. Is there any way of replacing the question mark with the correct character (é) or is it lost? Answer From the …
Tag: utf-8
Non-ASCII characters are not correctly displayed in PDF when served via HttpResponse and AJAX
I have generated a PDF file which contains Cyrillic characters (non-ASCII) with ReportLab. For this purpose I have used the “Montserrat” font, which support such characters. When I look in the generated PDF file inside the media folder of Django, the characters are correctly displayed: I have embe…
How to encode UTF-8 to Unicode escape sequences like “u00C1” using PHP?
How to encode UTF-8 to Unicode escape sequences like “u00C1” using PHP? I found several posts about the opposite. What I am trying to do is to convert something like Á to u00C1 to use with Google Charts and some JavaScript alerts. At this time, I am using a function containing several replaces lik…
Html2canvas image capturing issue with UTF-8 characters
I want to capture my webpage, In order to this I find html2canvas, when I use as shown below ,my UTF-8 (persian) characters get in trouble and this direction destroyed as you see. HTML: JavaScript: WebPage: Captured WebPage via html2canvas: you can see full example here What is wrong with my implementation? A…
Using Javascript’s atob to decode base64 doesn’t properly decode utf-8 strings
I’m using the Javascript window.atob() function to decode a base64-encoded string (specifically the base64-encoded content from the GitHub API). Problem is I’m getting ASCII-encoded characters back (like ⢠instead of ™). How can I properly handle the incoming base64-encoded stream so that it̵…
Convert integer array to string at javascript
Here is php code: the output is: 中文chinese Here is javascript code: the output is: 䏿chinese So how should I process the array at javascript? Answer JavaScript strings consist of UTF-16 code units, yet the numbers in your array are the bytes of a UTF-8 string. Here is one way to convert the string, which us…
Extract substring by utf-8 byte positions
I have a string and start and length with which to extract a substring. Both positions (start and length) are based on the byte offsets in the original UTF8 string. However, there is a problem: The start and length are in bytes, so I cannot use “substring”. The UTF8 string contains several multi-b…
reading in utf-8 file (javascript XMLHttpRequest) gives bad european characters
can anyone help? I have small procedure to read in an UTF-8 file with javascript using XMLHttpRequest.. this file has european characters like miércoles sábado etc.. Notice the accents.. But when being read in .. the characters are all messed up.. I have checked the file and it is perfect.. it must be the pro…