German umlauts and utf8 (Bugs)

by Irene @, Saturday, September 08, 2007, 11:23 (4424 days ago)

Just a note for those who has problems with umlauts in a German forum with charset utf8 (so you can display cyrillic fonts or arabic or whatever, too). The problem occured with PHP5 and MySQL 5.

I had a hard time figuring out why on heaven the umlauts where displayed as ?, e.g. l?schen instead of löschen. Last night I resolved the problem in adding the following line to functions.php immediately after mysql_connect() and mysql_select_db():


mysql_query('SET NAMES utf8')

Hope, this helps. irene

Avatar

German umlauts and utf8

by Micha ⌂, Friday, September 21, 2007, 22:33 (4410 days ago) @ Irene

Hi,


mysql_query('SET NAMES utf8')

Hope, this helps. irene

First, I think *wow*. Now, I have some problems with quote's (and the quote-symbol).

Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

German umlauts and utf8

by Alex ⌂ @, Friday, September 21, 2007, 23:18 (4410 days ago) @ Micha

Hi,

as you can see here, umlauts are displayed correctly: äöü (and also e.g. Chinese characters if your OS supports them: 树).

Maybe you edited a script file and didn't save it in UTF-8 format?

Alex

Avatar

German umlauts and utf8

by Micha ⌂, Saturday, September 22, 2007, 08:06 (4410 days ago) @ Alex

Hi Alex,

Maybe you edited a script file and didn't save it in UTF-8 format?

There ist no file in your ZIP-archiv with is saved in UTF-8. I am useing Notepad++ and I think, this editor catch the format from the file. Notepad++ show me, that every file is ANSI.

If I add the line mysql_query('SET NAMES utf8'); on line 41:


  $connid = @mysql_connect($host, $user, $pw) or raise_error('mysql_connect',mysql_error());
  //Add by Michael Loesler - 13.09.2007
  mysql_query('SET NAMES utf8');
  @mysql_select_db($db, $connid) or raise_error('mysql_select_db',mysql_error());

and save the functionfile as utf-8, I get the following warnings:

Warning: Cannot modify header information - headers already sent by (output started at /includes/functions.inc.php:1) in /modules/bad-behavior/bad-behavior/screener.inc.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at /includes/functions.inc.php:1) in /includes/main.inc.php on line 194

Warning: Cannot modify header information - headers already sent by (output started at /includes/functions.inc.php:1) in /index.php on line 156

Please, tell me, what I have to do.

regards Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

German umlauts and utf8

by wufenpu ⌂, Monday, December 10, 2007, 17:13 (4330 days ago) @ Micha

First, thanks for Irene. It works for Chinese sites, too.

Second, to Milo. You should go to download Editplus2 at http://editplus.com. Make sure you check "support utf-8 files without byte order mark" at Tools-> Files before you save the files, then you can avoid the problem you have now.

RSS Feed of thread
powered by my little forum