Swedish characters and UTF-8

前端 未结 7 1960
有刺的猬
有刺的猬 2020-12-01 20:59

I use UTF-8 on all my pages, but some Swedish characters (å ä and ö) get messed up (just a square box with some letters in). My database is set to utf8_gener

相关标签:
7条回答
  • 2020-12-01 21:39

    I think the server serving the page is overriding the encoding. Can you please try: Setting charset information in .htaccess.

    0 讨论(0)
  • 2020-12-01 21:41

    Works fine for me either double-clicking a file (as long as the editor is utf-8 capable) or serving it from localhost (Apache, defaults to UTF-8).

    You should indeed check what HTTP headers your web server is sending along the file. If your previous content is in English (read: ASCII) you may have never had a hint that your server was overriding the infile declaration of UTF-8 with a header saying ISO-8859-1 or Windows-1252.

    You may take a look at the headers in realtime with some Firefox extensions like Live HTTP Headers or HTTPFox. If this is the cause of the mishap and your server is Apache just add the line AddDefaultCharset utf-8 either in the mainl httpd.conf file or a .htaccess file in the webroot folder.

    0 讨论(0)
  • 2020-12-01 21:45

    I know this is old, but I came across the same problem.

    I just needed to set the correct charset:

    <meta http-equiv="content-type" content="text/html" charset="ISO-8859-1" />
    
    0 讨论(0)
  • 2020-12-01 21:45

    I found "https://www.html.am/reference/html-special-characters.cfm" and by entering the characters code, I was able to imply whichever character I was looking for. No need to import a specific lib or anything.

    Example: Swedish 'ä' = ä . So 'Stapelbäddsparken' = Stapelbäddsparken in HTML.

    I hope this will be helpful.

    0 讨论(0)
  • 2020-12-01 21:47

    This is pretty old but I came across the same problem and I thought I would share the solution. Make sure your text editor is saving the file as utf-8 encoded. It isn't enough to just set the encoding scheme in the meta-data to utf-8.

    This is how it works in dreamweaver:

    1) Click on Modify on the top panel of the window. 2) Select Page Properties 3) Select Title/Encoding 4) Set the encoding scheme to UTF-8

    Hope this helps.

    0 讨论(0)
  • 2020-12-01 21:50

    I just want to give my thoughts on this, since it might help others having this problem.

    Except setting the Charset on the site, one has to know what charset is used in the editor when creating the page.

    I have done the mistake many times to use UTF8 on the webpage, but in Notepad++ (my editor of choice) I use the standard charset which is ANSI, so my å ä and ö gets scrambled...

    So if swedish letters is not showing correctly on a UTF8 encoded site, then check the source file so the FILE is encoded with charset UTF8 aswell, then it should work.

    0 讨论(0)
提交回复
热议问题