Member Avatar for diafol

I'm losing the will to live!

I'm currently trying to place array values from php files into a mysql db table. As it happens some of the values have non-ASCII values:

e.g. “%1$s”

I seem to be able to encode all my usual accented characters, but the slanted inverted commas/quotes. They end up as some kind of gibberish:

“%1$sâ€.

My DB collation is UTF8/utf8_bin

My webpage encoding is UTF8

I have used:

mysql_query("SET NAMES 'utf8'");

as part of my connection procedure.

Background: this is for a phpBB language file translation, which is full of simple key-value arrays. I'm just reading the key+values and placing them into a table (id/key/value/translation).

I can enter slanted quotes into the DB manually, but then they don't show when retrieved (invisible).

Any ideas?

though i didnt understand ur question clearly but almost same problem i m also facing..!! which is related utf-8

first of all tell where are you facing problem.? in displaying non-ascii values on browser or inserting in db..?

what i found is to convert the value into hexadecimal.. n insert it in db

Member Avatar for diafol

OK Sam - I've finally cracked it (just now). I had (stupidly) placed a htmlentities() function upstream of the offending piece of code. As soon as I took this out - no problem. The db still stores gibberish, but at least it now displays properly in html. I also had to take out the mysql_query("SET NAMES 'utf8'");. Doh!

So solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.