I have a file url (file:///...) with an umlaut in a intranet solution.
The url is encoded which turned the ä into an %C3%A4.
When I click the link in Firefox/Chrome the character is an ä and the file is displayed.
In IE the character is changed to à which results in a 404-error.
I tried with and without the following charset definition but it does not seem to work. (The file is UTF-8 encoded)
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
I tried without encoding which does work but since I am using PHP-DOMDoc which causes the encoding I would rather not parse the content again.
I cannot avoid the umlauts in the urls since the customer enters these.
Is there any solution for this problem?
Related
I have some special characters for values coming from database like æ and Ø. When I inspect the database using phpmyadmin on both XAMPP and online, this is how it appears:
But in the processed PHP page, it appears fine locally, but not on the server. So basically, there is some problem on the online version which is preventing these values from being displayed properly.
I already have this in my head portion:
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
And in my .htaccess file:
AddDefaultCharset UTF-8
DefaultLanguage en-US
Collation is latin1_swedish_ci for the database, I tried switching it to utf-8 and that didn't help.
That is "Mojibake", wherein, for example, a 2-byte UTF-8 character
If I am not mistaken your examples disagree with the text. The following utf8 char maps to the matching 2-char pair when missmapped through latin1.
ü ü
ö ö
Ø Ã˜
æ æ
For more about the causes and cures: Trouble with UTF-8 characters; what I see is not what I stored
I am having a strange issue. I have Swedish characters. My charset works fine when in loop and being pulled from mysql using PHP but when I simply enter HTML text Swedish character Å, Ä and Ö it does not work. Currently this is my set Charset:
<meta http-equiv="content-type" content="text/html" charset="ISO-8859-1">
Here is a picture of how it looks in the browser:
Now here is a picture of data being pulled from Mysql (in loop) on the same page:
If this question has been asked before, please direct me to the page. Could it be somethign to do with the actual page encoding?
You should try this:
<meta http-equiv="content-type" content="text/html" charset="UTF-8">
Probably the file itself ist stored in UTF-8.Try and save it as a ANSI file.
In notepad++ this can be done via Encoding > Encode in ANSI in the menubar.
Or try to change the meta tag as already suggested.
I work on a website that has different language interfaces, so far I use english and german.
when the german text is loaded, it shows weird characters like the following screenshot
though I use
header('Content-type: text/html; charset=utf-8');
and also in the html header
<META http-equiv="content-type" content="text/html; charset=utf-8">
what else can I do to solve it ?
Thanks
The content of the page needs to also be in UTF-8. Your content was probably made using MS Word, which uses Windows 1251 encoding. You need to re-save your document as UTF-8.
UTF-8 does not convert formats for you.
If those strings are saved in a file, the file has to be encoded in UTF-8 too.
If you're getting them from a database, they'll have to be stored as UTF-8 and you'll have to set the connection charset to utf-8.
You could also check whether your text is UTF-8 and if not, convert it with utf8_encode.
I have a osCommerce 2.2 MST which has some custom additions to it. osCommerce itself is in ISO-8859-1. The addition has a table in a MySQL database which is now in utf8_general_ci (the others are all in latin1_swedish_ci). The php-file I'm calling outputs
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
As I mentioned before the data from the database is in UTF-8. But letters like ö,ä,ü are correct displayed. How can this be? There should be no utf8_decode. But the letter č is displayed as ?. I get this directly as result array. If I make the query with phpmyadmin it is correct displayed.
I managed to get all letters correct displayed (only in one section of the script). This is what I made
mysql_query("SET NAMES 'utf8'");
In the php-script I also added
header('content-type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
But then other problems occured.
What I want to know why data in UTF-8 is "correctly" displayed when it should be not. And how do I get the letter č correctly displayed?
The system is I find rather complex. Where and how can I look what is wrong here?
I don't know the sequence of encodings/decodings that your data go through, but the reason that letters like ö, ä, and ü are correct, while č is not, is that ö, ä, and ü can be encoded in ISO-8859-1, but č cannot. You will need to use UTF-8 instead of ISO-8859-1 in your HTML to get č to display.
We are in the process of converting to UTF-8 throughout our site. For the most part we've not had any problems, but presently the ® symbol shows up in the views as an invalid character, but when if the value is output in the Controller then it is displays correctly.
We have made certain to include the meta attribute in the main view:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
Is there a setting that we are missing?
Your files should be UTF-8 encoded (UTF-8 without BOM, ANSI as UTF-8).
Note: Kohanas' HTML::chars() uses Kohana::$charset to decide which charset to use when encoding, so use it instead of htmlspecialchars().