How do I enter anad render Germany Characters: > ö <

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

I just did an export.
Opened the Export file in Sublime.
Changed the Latin charset to UTF8.

Then imported it into PHPmyadmin.

And yet the characters are still showing diamonds.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How do I enter anad render Germany Characters: > ö <

Post by Celauran »

Tried something like this? http://stackoverflow.com/questions/6115 ... n-to-utf-8

Back up your data first, obviously.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How do I enter anad render Germany Characters: > ö <

Post by requinix »

That "Umrüstsätze" is UTF-8. Make sure your terminal is using UTF-8 and you'll see the proper characters.

Execute these queries with PHP code and have it output the results, then post it here. (Works just like a regular SELECT; the first will return multiple rows.)

Code: Select all

SHOW VARIABLES LIKE '%char%'

Code: Select all

SHOW CREATE TABLE <whatever table contains that data you posted>
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

[text]CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`titletag` varchar(30) DEFAULT NULL,
`metadescription` text,
`metakeywords` text,
`catid` int(3) DEFAULT NULL,
`catname` varchar(30) DEFAULT NULL,
`uk_catname` varchar(30) NOT NULL,
`subid` varchar(3) DEFAULT NULL,
`subname` varchar(50) DEFAULT NULL,
`uk_subname` varchar(30) NOT NULL,
`romancode` varchar(255) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`uk_title` varchar(30) NOT NULL,
`description` text,
`uk_description` text NOT NULL,
`offer` varchar(100) DEFAULT NULL,
`review` varchar(255) DEFAULT NULL,
`video` text,
`video_title` varchar(100) DEFAULT NULL,
`videomobile` text,
`video2_title` varchar(100) DEFAULT NULL,
`video2` text,
`pricedrop` varchar(10) DEFAULT NULL,
`pricedropenable` varchar(5) DEFAULT NULL,
`producttype` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `title2` (`title`),
FULLTEXT KEY `title` (`title`),
FULLTEXT KEY `description` (`description`),
FULLTEXT KEY `title_2` (`title`)
) ENGINE=MyISAM AUTO_INCREMENT=1348 DEFAULT CHARSET=utf8[/text]
Attachments
screenshot
screenshot
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How do I enter anad render Germany Characters: > ö <

Post by requinix »

The problem is with your webpages, right? Are you using phpMyAdmin to render your webpages? No, you are using PHP code. So you have to do the %char% query using PHP code.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

Simple rendering a page with this?

Code: Select all

<?php
mysql_query("SHOW VARIABLES LIKE '%char%'");
?>
?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

Well that's very strange.

I have a tool that renames the categories and subcategories. I resaved it as utf8. Then I ran the queries and it renamed them, and showed the characters correctly throughout!! Thought I had cracked it.

Then I ran a query to set them all to lowercase.

Code: Select all

UPDATE products SET title = LOWER(title);# 3 rows affected. UPDATE products SET catname = LOWER(catname);# 415 rows affected. UPDATE products SET subname = LOWER(subname);# 54 rows affected. 
This tho has put them all back to being bad, and I have all the diamonds back again!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

Setting it to lowercase sets the field content for this particular word to:
[text]zubehã¶r[/text]
Then if I run an update and rename it (basically using the same text seen on screen), it changes the content in the field to this... which breaks it:
[text]zubehör[/text]
It's really confusing.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I enter anad render Germany Characters: > ö <

Post by simonmlewis »

If I use this, to ensure new and editing categories are lowercase in the system, it creates a diamond:

Code: Select all

$subname = isset($_POST['subname']) ? $_POST['subname'] : null;
$subname = strtolower($subname);
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply