Problem with mbstring data

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

Post Reply
francophobe
Forum Newbie
Posts: 2
Joined: Sat Jun 27, 2009 11:27 pm

Problem with mbstring data

Post by francophobe »

I have a mysql database and php application that captures, stores, retrieves and displays data correctly - including French language words with accents. It has been running for around five years. I've recently written an extension that creates an openoffice writer document using this data. Everything works okay apart from the these wretched French characters!!! If I unzip the odt package and examine content.xml, then the characters are wrong - but simply cutting and pasting correct ones in gives me a working document, so the error is definitely in the way I am creating the content using php.

An example of the problem is Côte. As I've just typed it, the o has a circumflex accent or 'hat' on it. Within the odt file, the o-circumflex is shown as ô. Piping this to od -c gives 303 203 302 264. If I take the o-circumflex character from gnome charmap and od -c this, then I get 303 264. Where are these two middle bytes coming from? I've tried various combinations of mbstring functions and ini file settings but without joy.

Thanks for any help you can give me.
francophobe
Forum Newbie
Posts: 2
Joined: Sat Jun 27, 2009 11:27 pm

Re: Problem with mbstring data

Post by francophobe »

Hi

Sorry for the delay in responding, I have been distracted. I am using php's XML component to create the file and so create the document using

$this->Content = new DOMDocument('1.0', 'utf-8');

rather than a fopen.

However, you've set me thinking along a new path, so thanks for your post.

Nick
Post Reply