Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8419

Re: utf8_encode(utf8_decode(string)) doesn't return same string

From Giacomo M <kylnas@tiscali.it>
Newsgroups comp.lang.php
Subject Re: utf8_encode(utf8_decode(string)) doesn't return same string
Date 2013-02-21 20:13 +0100
Organization Aioe.org NNTP Server
Message-ID <kg5rke$pp4$1@speranza.aioe.org> (permalink)
References <kg58c5$tgp$1@speranza.aioe.org> <kg5dr6$lgn$2@news.albasani.net> <kg5g7e$qn2$1@news.albasani.net> <kg5plp$jk2$1@speranza.aioe.org> <timstreater-BB1E51.19085621022013@news.individual.net>

Show all headers | View raw


Il 21/02/2013 20:08, Tim Streater ha scritto:
> In article <kg5plp$jk2$1@speranza.aioe.org>,
> Giacomo M <kylnas@tiscali.it> wrote:
>
>> Il 21/02/2013 16:58, The Natural Philosopher ha scritto:
>> > "Please note that utf8_decode simply converts a string encoded in UTF-8
>> > to ISO-8859-1. A more appropriate name for it would be
>> utf8_to_iso88591.
>> > If your text is already encoded in ISO-8859-1, you do not need this
>> > function. If you don't want to use ISO-8859-1, you do not need this
>> > function.
>> >
>> > Note that UTF-8 can represent many more characters than ISO-8859-1.
>> > Trying to convert a UTF-8 string that contains characters that can't be
>> > represented in ISO-8859-1 to ISO-8859-1 will garble your text and/or
>> > cause characters to go missing. Trying to convert text that is not
>> > encoded in UTF-8 using this function will most likely garble the text."
>>
>> Not my case. I first encode an ISO string in UTF, after i decode the
>> same string. Why I get differet strings?
>
> Your title doesn't say that. It says you decode first, then encode.

Is it not the same?

I have an ISO-8859-1 xml file that I have to load with simplexml, so I 
first decode it. After that, I want to encode to return to ISO-8859-1. 
But I get different string.

-- 
Giacomo

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

utf8_encode(utf8_decode(string)) doesn't return same string Giacomo M <kylnas@tiscali.it> - 2013-02-21 14:44 +0100
  Re: utf8_encode(utf8_decode(string)) doesn't return same string The Natural Philosopher <tnp@invalid.invalid> - 2013-02-21 15:18 +0000
    Re: utf8_encode(utf8_decode(string)) doesn't return same string The Natural Philosopher <tnp@invalid.invalid> - 2013-02-21 15:58 +0000
      Re: utf8_encode(utf8_decode(string)) doesn't return same string Giacomo M <kylnas@tiscali.it> - 2013-02-21 19:39 +0100
        Re: utf8_encode(utf8_decode(string)) doesn't return same string Tim Streater <timstreater@greenbee.net> - 2013-02-21 19:08 +0000
          Re: utf8_encode(utf8_decode(string)) doesn't return same string Giacomo M <kylnas@tiscali.it> - 2013-02-21 20:13 +0100
            Re: utf8_encode(utf8_decode(string)) doesn't return same string Tim Streater <timstreater@greenbee.net> - 2013-02-21 22:29 +0000

csiph-web