468,758 Members | 2,089 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,758 developers. It's quick & easy.

Reading (and keeping) Accented and Special Characters

I'm using the php 'file' command to read the contents of an ASCII text
file to a variable. The original text file contains some accented and
special characters. The problem arises when I echo this variable: the
accented characters are messed up. And not only accented characters, for
example, the special characters ª is printed as ª. What can I do to
correct this issue? I have tried, without success, to use the 'setlocale'
command.

TIA,

Bernhard Enders.
Jul 17 '05 #1
1 3527
Bernhard Georg Enders wrote:
I'm using the php 'file' command to read the contents of an ASCII text
file to a variable. The original text file contains some accented and
special characters.
Those are not ASCII characters!
The problem arises when I echo this variable: the
accented characters are messed up. And not only accented characters, for
example, the special characters ª is printed as ª. What can I do to
correct this issue?
Output the contents of the (not ASCII) text file using the same
character encoding that was used to create the file.
I have tried, without success, to use the 'setlocale'
command.


You may be able to read whatever encoding was used for the file and
convert it:

http://www.php.net/iconv
http://www.php.net/mbstring
http://www.php.net/recode

Happy Coding :-)
--
USENET would be a better place if everybody read: | to mail me: simply |
http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, |
http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text |
http://www.expita.com/nomime.html | and *NO* attachments. |
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Phil Slater | last post: by
15 posts views Thread by Steve | last post: by
2 posts views Thread by Xero | last post: by
2 posts views Thread by Jack Russell | last post: by
4 posts views Thread by gsuns82 | last post: by
5 posts views Thread by Amy L. | last post: by
2 posts views Thread by Jeremie Le Hen | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.