...

View Full Version : é writes to files as É



Cacus
12-02-2008, 08:02 PM
Hi all

I am writing a simple text file with php and have run into a small prob. when writing the string:

$write_me = "née Smith";

the output text file is written as :

nÉe Smith

Any ideas why this would capitalise and how to get round it.

Cheers
Steve

oesxyl
12-02-2008, 09:01 PM
Hi all

I am writing a simple text file with php and have run into a small prob. when writing the string:

$write_me = "née Smith";

the output text file is written as :

nÉe Smith

Any ideas why this would capitalise and how to get round it.

Cheers
Steve
probably you use utf-8 for output and this is iso-8859-1. Try to change encoding.

regards

Cacus
12-02-2008, 09:06 PM
Hi thanks for the reply.

How do you change the encoding in php. I'm simply using the write function to save the string to a file.

Cheers

oesxyl
12-02-2008, 09:18 PM
Hi thanks for the reply.

How do you change the encoding in php. I'm simply using the write function to save the string to a file.

Cheers


<?php

$write_me = "née Smith";
echo mb_convert_encoding($write_me, "iso-8859-1", "utf-8");
echo $write_me."\n";

?>


I was wrong in my previous post, you use utf-8 and output is something else. mb_convert_encoding will fix this.

sorry, I forget:

http://www.php.net/manual/en/function.mb-convert-encoding.php
regards

Cacus
12-03-2008, 08:33 AM
Cheers will give it a go today.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum