Converting encoded strings

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Nunners
Forum Commoner
Posts: 89
Joined: Tue Jan 28, 2003 7:52 am
Location: Worcester, UK
Contact:

Re: Converting encoded strings

Post by Nunners »

Ok - so it's nearly 11pm here.. and I've finally got it...

If I make sure the header is always utf-8 it works... so simply adding

Code: Select all

header('Content-Type: text/html; charset=utf-8');
Before handling any of this works... I can see why, but not, if you get what I mean...

Thanks for your help though... it did help to sanitise that what I was doing should have been correct!
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Converting encoded strings

Post by Celauran »

So PHP was doing it right all along and the browser was mucking it up due to a bad encoding? Well, glad it's sorted.
Nunners
Forum Commoner
Posts: 89
Joined: Tue Jan 28, 2003 7:52 am
Location: Worcester, UK
Contact:

Re: Converting encoded strings

Post by Nunners »

Yeah - all sorted... however it wasn't wholly the browser...

The main area I was having problems with was actually in CLI, but this was primarily fixed by changing the headers - odd I know, but it works!
Post Reply