1
Mazarin
Problem displaying special characters (åäö) from custom database
  • 2009/1/16 13:30

  • Mazarin

  • Just can't stay away

  • Posts: 533

  • Since: 2008/12/10


I run 2.3.2b and am developing my own module, which retrieves data from a custom mySQL database (set up manually) on the same server as Xoops. However, I have a problem displaying Swedish special characters (åäö) retrieved from the database. Both the database and the php page are in UTF-8 format, and if I just write the text manually in the php, the special characters look fine in the browser.

Any ideas on what might be causing this and what I can do to remedy it?

Of course, I could use the htmlentities function on all database strings when writing them, but that's rather tedious and not a very elegant solution. And of course, the data from the XOOPS database displays åäö just fine, so it must be possible somehow.

2
ghia
Re: Problem displaying special characters (åäö) from custom database
  • 2009/1/20 1:03

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Did you set your database connection to UTF-8?
How do the characters look in the database and in the browser?
The reason why info from the XOOPS database looks fine, is probably the use of the displayTarea function in the textsanitizer class.

3
Mazarin
Re: Problem displaying special characters (åäö) from custom database
  • 2009/1/20 12:29

  • Mazarin

  • Just can't stay away

  • Posts: 533

  • Since: 2008/12/10


Yes, I have the database connection set to UTF-8. The characters in the database looks exactly like they should do, but when displayed on the web page, they look like I haven't encoded the page in UTF-8.

Regardless, I'm currently using the htmlentities function in my code to correct it, so at least I have a way around it, but perhaps it could be suggested to look into this problem for the future.

Login

Who's Online

210 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 210


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits