how to fix the “warped characters” issue in a haskell project? [closed]

Report
Question

Please briefly explain why you feel this question should be reported .

Report Cancel

i cloned this haskell-based blog project:

git clone https://phabricator.chromabits.com/diffusion/B/blog blog-by-chromabits

i setup a blog successfully: http://cb.smt.biz.st ,but a post written in chinese has “warped characters”,the post is http://cb.smt.biz.st/posts/2016/08/13/test-1/ ,

how to fix this “warped characters” issue?

solved 0
1 Answer 9 views 0

Answer ( 1 )

  1. Anonymous
    2
    January 12, 2017 at 9:30 am

    Please briefly explain why you feel this answer should be reported .

    Report Cancel

    Your website is encoded in UTF-8, and does in fact contain proper chinese text. Your problem is that the website doesn’t advertise that it is encoded that way, therefore any browser you’ll use will simply take an educated guess (which will often be wrong). For example, Chrome on Windows 10 picks Windows-1252 as the character encoding for me, which is of course wrong. A browser on linux might default to UTF-8 instead, so a user like that might not see anything wrong.

    A simple bandaid fix for this would be to simply state the encoding in the html header:

    <head>
       <meta charset="utf-8">
    </head>
    

    that will fix it for that page at least. Going forward you should set up your webserver to send the correct encoding in the HTTP header (it’s part of the Content-Type header field, see here for details).

    You can also tell your browser to use a particular encoding for a website to diagnose issues like this.

    Best answer

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>