Page 1 of 2
How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 4:54 am
by simonmlewis
I need to render Germany characters on screen.
I have read a few pages on it, but they seem to tell you to add a ton of code. But if you search for "germany Zubehör" on Google, results come up with that characters correctly shown, using UTF-8 I'm sure.
So how do you do it?
Mine are coming up as the diamonds.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 5:16 am
by requinix
Pick a character encoding. For example, UTF-8. Then make sure:
1. Your web pages are using UTF-8, like with a <meta charset>.
2. Your PHP files are saved using UTF-8, in case you put non-ASCII characters in them.
3. Your database connection is using UTF-8.
4. Your databases, tables, and columns are all using UTF-8.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 5:22 am
by simonmlewis
1. Your web pages are using UTF-8, like with a <meta charset>.
Yes that is done
2. Your PHP files are saved using UTF-8, in case you put non-ASCII characters in them.
I use Notepad to do that. But not sure how to ensure it is UTF-8??
3. Your database connection is using UTF-8.
How do I check that?
4. Your databases, tables, and columns are all using UTF-8.
How do I check this please?
Re: How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 5:27 am
by simonmlewis
I've checked the notepad2 screen and it says ANSI, which I am assured is correct.
The database connect script was made using that.
The tables are now: utf8_german2_ci. Is that correct?
The text from the DB are still showing diamonds.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 6:29 am
by requinix
simonmlewis wrote:2. Your PHP files are saved using UTF-8, in case you put non-ASCII characters in them.
I use Notepad to do that. But not sure how to ensure it is UTF-8??
Why are you using Notepad to write code? WHYYY!?
simonmlewis wrote:3. Your database connection is using UTF-8.
How do I check that?
simonmlewis wrote:4. Your databases, tables, and columns are all using UTF-8.
How do I check this please?
Have a read through
this. Yes, there is a lot to read.
simonmlewis wrote:I've checked the notepad2 screen and it says ANSI, which I am assured is correct.
So, wait, you're using Notepad2? Not Notepad?
You are assured? Meaning someone told you that is correct? Because they're wrong.
Perhaps you mean "assumed", as in "I saw the term 'ANSI' and, rather than Google it to see what it means, I
assumed it's the same thing as UTF-8".
However, as long as you aren't putting anything beyond simple ASCII characters into your files, you will be fine with that.
simonmlewis wrote:The database connect script was made using that.
The tables are now: utf8_german2_ci. Is that correct?
The text from the DB are still showing diamonds.
That is UTF-8 using a German language collation. (That link from earlier explains what collations are too.)
Re: How do I enter anad render Germany Characters: > ö <
Posted: Fri Apr 15, 2016 7:59 am
by simonmlewis
I read something on a page about Notepad2 that tells me ANSI is correct for UTF-8.
Therefore, I am "assured".
I have used Notepad and then Notepad2 for goodness knows how many years.
Sorry I am at a loss.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 9:55 am
by simonmlewis
I have a bit of an update on this.
Code: Select all
<!DOCTYPE html>
<html lang="de-de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
ausgefüllt
</body>
</html>
This echoes it wiht the black diamond.
If I simple save "ausgefüllt", it renders fine.
So something in that code is causing it.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:06 am
by requinix
If that file is showing question marks then you did not save it using UTF-8 encoding.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:08 am
by simonmlewis
If I do it with straightforward Windows Notepad, I have the same issue.
What's the usual tool people use? I have used Notepad2 for more years than I can remember.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:12 am
by simonmlewis
Well I'll be damned. I found it in Notepad2 where you change the encoding! Brilliant.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:19 am
by simonmlewis
The only issue now is that words that were perhaps not "INSERTED" with UTF-8, are rendering still with the black triangles.
Is there some tool I can run to convert them all? So all titles, category names etc are output as utf-8?
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:33 am
by Celauran
simonmlewis wrote:What's the usual tool people use? I have used Notepad2 for more years than I can remember.
Most people I know in the field use either Sublime Text or Atom. That's not related to your problem, but since you ask. Both certainly seem more capable than Notepad2
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 10:35 am
by simonmlewis
I'll look into them.
I've just backed up the database tables.
Deleted the database.
Recreated it as UTF8.
Imported the tables.
And still for the rendered content that has those characters, they show as black diamonds.
The database connection file is utf-8 saved.
So is the template file.
So is the internal file I am testing it with.
Re: How do I enter anad render Germany Characters: > ö <
Posted: Mon Apr 18, 2016 11:27 am
by requinix
simonmlewis wrote:I've just backed up the database tables.
Deleted the database.
Recreated it as UTF8.
Imported the tables.
And still for the rendered content that has those characters, they show as black diamonds.
The database's encoding sets the default encoding for new tables.
The table's encoding sets the default encoding for new columns.
The column's encoding is what actually matters as the column is what contains the data.
So if you really just recreated the database itself and simply imported the backed up tables then you won't have actually changed anything. Change the default encoding on all the tables, then change the encoding on each text (CHAR, VARCHAR, TEXT, etc.) column you have.
Remember that link I posted a while back? And told you to read through, even though there was a lot to read through? Did you read just that one page or did you look through all the documentation on character encodings and collations?
Re: How do I enter anad render Germany Characters: > ö <
Posted: Tue Apr 19, 2016 4:35 am
by simonmlewis
Umrüstsätze
Honestly? Not read through a lot of it. I do need to understand it, but I also need to fix the issue fairly quickly too.
The Collation of each field is: utf8_general_ci
But for example, I have updated a title, and the database is storing it like this: Umrüstsätze
So on the current version of the site, the links are broken because of the way it's rendered in the previous html code.
Surely it should store them with the correct wording? Is it not possible to just update all fields to be utf8 as well as "new" entries??