0

my JS-File is UTF-8 encoded, my html document also.

I also have this in the head part of the HTML:

<!doctype html>
<html lang="de">
<head>
    <meta charset="utf-8" />

Every umlaut that I typed in the HTML is displayed properly.

But if I try to set a new value with $('#test').text('Test öäü') I get Test öäü.

How is this possible? Even console.debug/log and alert() display the same.

I also tried to set the charset attribute on my script-tag, but nothing worked.

Can anybody help me with this issue?

aksu
  • 5,221
  • 5
  • 24
  • 39
Simon
  • 594
  • 2
  • 6
  • 25
  • You should check you IDE and database content and charset. – DontVoteMeDown Dec 26 '13 at 13:50
  • There is no database content, everything is static. As I mentioned above, I checked the files, all files are encoded with UTF-8. – Simon Dec 26 '13 at 13:51
  • try see encoding in browser settings – Grundy Dec 26 '13 at 13:53
  • In a new HTML file with only the basic elements, the issue is reproduced? Is it browser specific? – Tasos K. Dec 26 '13 at 13:54
  • 1
    1. Is that code in a separate JavaScript file, or in your HTML file? 2. In your browser's network tab, check the response headers for the relevant file and make sure there's a `Content-Type` header that correctly gives the `charset="utf-8"`, e.g., `Content-Type: text/html; charset=utf-8` for HTML, or `Content-Type: application/javascript; charset=utf-8` for JavaScript. I mean, fundamentally, with the correct content type(s), [that works](http://jsbin.com/eqAVAwOd/1). – T.J. Crowder Dec 26 '13 at 13:58
  • `` is this tag correctly available inspect with firebug/webinspector. – Jai Dec 26 '13 at 13:58
  • 1
    Thanks @T.J.Crowder, I found the issue. I use minify to combine my css/js and minify had $min_serveOptions['contentTypeCharset'] set to iso-8859-1. Thank you! :) – Simon Dec 26 '13 at 14:00
  • 1
    [jQuery doesn't display Hebrew](https://stackoverflow.com/a/10746858/6209936) I have problem like yours. And this answer resolve it – gongsun Jul 31 '17 at 10:33

1 Answers1

0

I found the issue. I use minify to combine my css/js and minify had $min_serveOptions['contentTypeCharset'] set to iso-8859-1.

Simon
  • 594
  • 2
  • 6
  • 25