473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3820
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Phil Slater | last post by:
I'm trying to process a collection of text files, reading word by word. The program run hangs whenever it encounters a word with an accented letter (like rôle or passé) - ie something that's not a...
15
by: Steve | last post by:
Hi, I've been charged with investigating the possibilities of internationalizing our C++ libraries. std::strings are used all over the place, and unfortunately a mixture of...
2
by: Xero | last post by:
Hello. How can I store accented characters in text files? Thanks. -- Xero http://www.chezjeff.net My personal web portal
2
by: Jack Russell | last post by:
I have a file I read with streamreader If I put accented characters in the file i.e. &Annulerèà It ignores the foreign characters. Is there a way of reading these? Thanks Jack Russell
2
by: James Minns | last post by:
Hi, I have the following problem with my VB code: accented characters are being transformed into a cr-lf pair! I am reading a sequence of bytes from a binary file, one part of which is a text...
2
by: gsuns82 | last post by:
Hi all, I have to replace accented characters from a input string with normal plain text.I have coded as follows. String input = "ÄÀÁÂÃ"; input=...
4
by: gsuns82 | last post by:
Hi all, I am facing a strange issue. i.e: I have a jsp page with an input text field where the user can enter searching value even along with Accented Characters.After that i...
5
by: Amy L. | last post by:
I am at an absolute loss on what is going on here. I have a text file with some Spanish writing. Some of the characters have accents. I have not found anyway to read this text file and echo the...
2
by: Jeremie Le Hen | last post by:
(Mail resent with the proper subject. Hi list, (Please Cc: me when replying, as I'm not subscribed to this list.) I'm working with Unicode strings to handle accented characters but I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.