Question

I'm from Poland. Polish characters are avalible in UTF-8 and ISO 8859-2 encoding but When I opening file I haven't National Characters (ę, ó, ą, ś, ł, ż, ź, ń) in site content. It's my code in NodeJS when I opening file and sending to client :

var include = function(path) {
    var code = fs.readFileSync(ROOT+path, 'ascii');
 return code;
}.bind(this);

Code example:

<!DOCTYPE html>
<html>
 <head>
     <title>Ninja World :: Strona główna</title>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
</head>
<body>
Cześć, tu Kongo i to jest próbny tekst stworzony dla Stack Overflow.
</body>

(English: Hi, I'm Kongo and it is attemp text created for Stack Overflow.) This code return it (Coding format: ISO-8859-2): http://scr.hu/7wh/ntq98 When I converted on UTF-8 this code return it: http://scr.hu/7wh/zva6s (And this is good result ;) ) Anybody can help me to show my National characters ? :)

PS: Sorry for bad English ;)

Was it helpful?

Solution

well that line

var code = fs.readFileSync(ROOT+path, 'ascii');

I think you should use the utf-8 encoding instead of ascii.. have you tried that?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top