Anything special about '

Ajax transactions, by fiat, are all conducted in UTF-8 Unicode. Web
pages may or may not be encoded that way, and it does take some
coercion to get PHP to do this. If you are getting your data out of
MySQL, then check to see which encoding the table and column are in.

I make a habit of forcing all of my databases to UTF-8, and add the
following set of belt-and-suspenders shims to enforce the correct
behavior in PHP/MySQL. Also, use a text editor that allows you to
choose your encoding, and make sure all of your PHP is actually
written in UTF-8. For some reason, this helps.

//put this before anything else in all your PHP
mb_internal_encoding(“utf-8”);

//Issue the following query before each request of the database
//(I’m using MyActiveRecord, but just make sure the query gets sent
somehow)
MyActiveRecord::Query(‘SET CHARACTER SET utf8’);

If you can wait that long, PHP6 is supposed to be entirely Unicode-
clean and everything will run in UTF-8 out of the “box”.

If you’re mixing your hand-coded (Unicode) PHP into a Freeway layout,
then check to be sure that Freeway is actually encoding your page in
UTF-8. ‘Automatic’ is supposed to equal UTF-8, but I have seen it do
other things besides that. Setting the page encoding to Unicode will
definitely do the right thing.

Walter

On Mar 31, 2011, at 9:49 AM, David Ledger wrote:

I’m working with a list of alternative fabric ranges as options to
chairs in PHP. Because the different ranges cost differently I’m
adding the incremental prices as strings to the ends names of the
fabric ranges in a popup list.
So a range might be presented as
Stirling Tweed (+ £1.45)

The problem is that when I refresh the page this shows as
Stirling Tweed (+ £1.45)

  • that’s (cap A circumflex) (UK pound)
    but if I do an Ajax refresh of the div containing the popup it is
    correct.

It is getting put through urlencode() but as far as I can see this
generates %C2%A3 which looks like unicode but I don’t know how to
check if it’s unicode for UK pound without searching though the
thousands of table entries.

As character entities, %C2 is  (cap A circumflex) and %A3 is £ (UK
pound) so it looks like I’m getting my encodings mixed somewhere.

Anyone know what to look for?

David


David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options