characters are read wrong?

This is a discussion on characters are read wrong? within the PHP Language forums, part of the PHP Programming Forums category; hi all, I use $lijst = file('lijst.txt'); to read the file 'lijst.txt' line by line. When I echo $...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-09-2004
Stijn Goris
 
Posts: n/a
Default characters are read wrong?

hi all,

I use $lijst = file('lijst.txt'); to read the file 'lijst.txt' line by
line. When I echo $lijst some chracters are changed.

Original file (lijst.txt)
(I'll Never Be) Maria Magdalena - Sandra
(Tell It All About) Boys - Dolly Dots
9 To 5 - Dolly Parton
A Brand New Day - Wiz Stars
A Love Bizarre - Sheila E.
A Walk In The Park - Nick Straker Band
Ain't No Mountain High Enough - Boys Town Gang

array $lijst contains:
(Tell It All About) Boys â?" Dolly Dots
9 To 5 â?" Dolly Parton
A Brand New Day â?" Wiz Stars
A Love Bizarre â?" Sheila E.
A Walk In The Park â?" Nick Straker Band
Ainâ?Tt No Mountain High Enough â?" Boys Town Gang

the -, and ' characters are changed. Someone knwos why this is and what can
be done?

Regards
Stijn


Reply With Quote
  #2 (permalink)  
Old 10-09-2004
Daniel Tryba
 
Posts: n/a
Default Re: characters are read wrong?

Stijn Goris <mepisto@hotmail.com> wrote:
[orignal]
> Ain't No Mountain High Enough - Boys Town Gang


[file()]
> Ain??Tt No Mountain High Enough ??" Boys Town Gang
>
> the -, and ' characters are changed. Someone knwos why this is and what can
> be done?


How are you testing this? First line is plain old ASCII, second one
looks like UTF-8 displayed as iso8859-1.

Does the original actually include simple ' and - characters, or is your
editor playing tricks on you (much like Andy suggested in you explode
question).

Putting both the original file and the php processing it online would
really be helpfull IMHO.

--

Daniel Tryba

Reply With Quote
  #3 (permalink)  
Old 10-09-2004
Andy Hassall
 
Posts: n/a
Default Re: characters are read wrong?

On Sat, 9 Oct 2004 15:23:57 +0200, "Stijn Goris" <mepisto@hotmail.com> wrote:

>I use $lijst = file('lijst.txt'); to read the file 'lijst.txt' line by
>line. When I echo $lijst some chracters are changed.
>
>Original file (lijst.txt)
>(I'll Never Be) Maria Magdalena - Sandra
>(Tell It All About) Boys - Dolly Dots
>9 To 5 - Dolly Parton
>A Brand New Day - Wiz Stars
>A Love Bizarre - Sheila E.
>A Walk In The Park - Nick Straker Band
>Ain't No Mountain High Enough - Boys Town Gang
>
>array $lijst contains:
>(Tell It All About) Boys â?" Dolly Dots
>9 To 5 â?" Dolly Parton
>A Brand New Day â?" Wiz Stars
>A Love Bizarre â?" Sheila E.
>A Walk In The Park â?" Nick Straker Band
>Ainâ?Tt No Mountain High Enough â?" Boys Town Gang
>
>the -, and ' characters are changed. Someone knwos why this is and what can
>be done?


See my reply to your other post - they're almost certainly not - and ',
they're em-dash and left- and right-quotes (a.k.a. "smart quotes"). These don't
exist in the iso8859-1 character set encoding, as commonly used on the web.

In fact, the way they're being converted into three characters looks a lot
like UTF-8, although I've not checked the character values you've posted.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0