Do we have any PHP / MySQL gurus in the house, or anyone that knows of one. Have a couple of issues that i cannot solve and would appreciate it if someone could give a chap a hand.
Issue is one of displaying chinese characters within data being retrieved form the sql database. As far as i can see all character encoding is being done in utf8 including the webpage, but the characters are still displaying as the usual ???
Everything works ticker, just this small issue to resolve.
Usually if characters are displayed as question marks or square boxes that means that the encoding is correct but the font used does not support the characters or the appropriate fonts are not installed on the system.
Can you provide more detail on what browser is used, what OS, the web server used, and any other relevant details? Or is there a publicly available demo?
I’m mostly still using pre-4.11, but here’s what worked for me with 5.0 and unicode:
In the database, column collations are set to utf-8
In the PHP script, the first query after connecting to the database is SET NAMES ‘utf8’
For output, is included in the HTML head
I’d also make sure that it’s not the input (import) method causing the problem (have a look at the columns, maybe they actually just contain question marks).
[quote=“jlick”]Usually if characters are displayed as question marks or square boxes that means that the encoding is correct but the font used does not support the characters or the appropriate fonts are not installed on the system.
Can you provide more detail on what browser is used, what OS, the web server used, and any other relevant details? Or is there a publicly available demo?[/quote]
jlick, it was publicly available, but not now after i upset something, still trying to fix that. I also thought of fonts, but using exactly the same clinet, i can either through phpMy Admin or by displaying the table contents can see the proper characters. As phpMyAdmin is browser based it cannot be missing fonts.
As to browsers being used, am checking with both Firefox and IE7, OS is XP with SP2 and server is Apache 2.2.3.
Once i get the system public again will let you know, then you can have a look at it.
I’m mostly still using pre-4.11, but here’s what worked for me with 5.0 and unicode:
In the database, column collations are set to utf-8
In the PHP script, the first query after connecting to the database is SET NAMES ‘utf8’
For output, is included in the HTML head
I’d also make sure that it’s not the input (import) method causing the problem (have a look at the columns, maybe they actually just contain question marks).[/quote]
Hypermegaglobal, thanks for this, you may have hit on something here with item 2 in your list, but am not sure how to do this, as i use Macromedia Dreamweaver to build the site, and this does all the PHP work etcv for me, so not sure where this additional line or even the syntax for it needs to go.
If i browse the table contents through the browser based phpMyAdmin then everything is fine, so it must be something to do with my connections or the returning data.