Closed makotot closed 11 years ago
Usually you'd set it with <meta charset='utf-8'>
. Anything other than utf-8 should probably require a very good reason though. Do you really need characters that can't be represented in utf-8?
I think some chinese characters cannot represent in utf-8, and I have to think about it.
I think utf8 aims to have pretty good support for chinese characters.
Nodefront does default to UTF8 when calling response.write(). Could you provide me with an example file that triggers the issue? That way, I can test to see what's causing the problem and find a solution.
@karthikv
Like the following html, some characters cannot represent in utf-8. Therefore, i cannot use utf-8.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="Shift-JIS">
</head>
<body>
<p>髙</p>
<p>㈱</p>
</body>
</html>
The character "髙" is used in the last name of the japanese. The character "㈱" is a symbol that represents the corporation.
Odd that they both display fine here though (since this web-page is utf-8)?
@ForbesLindesay
The reason why they are not garbled is because this web-page's character code is utf-8. If the character code is shift-jis, they are garbled (in chrome browser, 『鬮』 and 『繹ア』).
In which case the problem is not that some of your stuff is in utf-8 it's that some of your files are in shift-jis. I'd recommend you simply convert them to utf-8 and use that. You'll find utf-8 has much better support in tooling, web-browsers etc.
My explanation is not so good. Since there is no decision of character code in the project to me, utf-8 is not available.
My advice would be to produce a utility to do the conversion into utf-8 and just run that before running nodefront. Nobody should be trying to use legacy text file formats.
Sorry for the late reply. Thank you give me advice.
I have run into situations where I think the problem is probably not related to character code. I will check again.
Charactor code in my project is shift-jis. When i use serve command, nodefront automatically set the charactor code to utf8. Therefore, html is garbled when viewed in browser. Is there any solution?
thanks.