views:

36

answers:

1

Hello,

My Javascript function returns a char arrya which might contain non-printable characters. In fact each character is a byte (represented as a number from 0-255). The problem is that when I try to copy this char array to the notepad, for example, I get these results:

ORIGINAL STRING IN JAVASCRIPT:
performance of thisĎask, ćd so modest hā conductėďaĤĦĞaġ proposalĒČĵrriageėġclaŅngĥimselfėĔĘ furďħiīĭemenį willŢőtĝĶĻijħĜnėwhoėĴĔŕşedŹoulĚbeĩŦśŌevħĆŸ ičĴwāĊcŎeŝŭy bĺughĤup. TĦƠƘrĊĆńiƂ;ĨƜƞĨƆtivIJiĪ ŅĀnƂĎĴtĿŧtĒźich nIJŞĊhĶơĢűƘƃĘī MŖĢiňDžĒĜǁsŞpſdžĐǧǐooŗŖlowĒŢ

STRING PASTED TO NOTEPAD:
performance of this?ask, ?d so modest h? conduct??a???a? proposal???rriage??cla?ng?imself??? fur??i??emen? will??t??????n?who?????ed?oul?be????ev??Ÿ i??w??c?e??y b?ugh?up. T???r???i?;?????tiv?i? ??n???t??t??ich n???h???????? M??i?????s?p?????oo??low??

What can I do to have this string properly represented on Notepad when pasting it? On my HTML I am using UTF-8.

THANKS

A: 

Try telling notepad to use UTF-8. Save a blank file making the Encoding (last parameter at the bottom of the save dialog) UTF-8.

Note that I am able to copy the UTF-8 out of the page into notepad, maybe you have an encoding problem in your javascript file?

lambacck
Thank you lambacck. Are you able to copy the code above and paste it to Notepad. Perhaps, as you said, it's a problem with our Javascript charset. Which one should we use? We have this code in the <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> THANKS
Arturo
The meta tag only talks about the HTML page, not there Javascript file. You will need to set the Content-Type header on the web server to get that. The default is ISO 8859-1 (latin1) which the browsers interpret as actually being cp1252 which is a superset of ISO 8859-1.
lambacck