Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  HXT: encoding problem (Elias Diem)
   2. Re:  HXT: encoding problem (Derek McLoughlin)
   3. Re:  HXT: encoding problem (Elias Diem)
   4. Re:  HXT: encoding problem (Elias Diem)
   5. Re:  HXT: encoding problem (Elias Diem)
   6. Re:  HXT: encoding problem (Derek McLoughlin)
   7. Re:  HXT: encoding problem (Elias Diem)


----------------------------------------------------------------------

Message: 1
Date: Sat, 27 Sep 2014 17:57:08 +0200
From: Elias Diem <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] HXT: encoding problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Hi guys

I have got the following haskell program:

------------------------------------------------------
import Text.XML.HXT.Core

main = do
    xml <- readFile "test_data-small.xml"
    let doc = readString config xml
    res <- runX . xshow $
        doc
        >>>
        getChildren >>> isElem >>> hasName "contacts"
        >>>
        deep isText
    mapM_ putStrLn res

config =
    [ withParseHTML                 no
    , withWarnings                  yes
    , withInputEncoding             utf8
    , withOutputEncoding            utf8
    , withValidate                  yes
    ]
------------------------------------------------------

The file 'test_data-small.xml' contains the following data:

------------------------------------------------------
<?xml version='1.0' encoding='UTF-8' ?>

<contacts>

<person>
    <name>
        <firstname>Max</firstname>
        <lastname>M?ller</lastname>
    </name>
</person>

</contacts>
------------------------------------------------------

Note the umlaut in the lastname!

If I run the program, I get the following error:

------------------------------------------------------
error: UTF-8 encoding error at input position 127: ValueOutOfBounds
------------------------------------------------------

Any help is appreciated. Thanks.

-- 
Greetings
Elias




------------------------------

Message: 2
Date: Sat, 27 Sep 2014 17:13:56 +0100
From: Derek McLoughlin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID:
        <CAAw9fm=2o-DhjpkAH5oWkPutccf1Eu2Ww9=0njvkrhrkavp...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I just ran this (OS/X + Platform 2014 + hxt 9.3.1.7) and it worked perfectly.

Are you sure that the XML file is actually saved with UTF-8 encoding?
Can you attach it?

On 27 September 2014 16:57, Elias Diem <[email protected]> wrote:
> Hi guys
>
> I have got the following haskell program:
>
> ------------------------------------------------------
> import Text.XML.HXT.Core
>
> main = do
>     xml <- readFile "test_data-small.xml"
>     let doc = readString config xml
>     res <- runX . xshow $
>         doc
>         >>>
>         getChildren >>> isElem >>> hasName "contacts"
>         >>>
>         deep isText
>     mapM_ putStrLn res
>
> config =
>     [ withParseHTML                 no
>     , withWarnings                  yes
>     , withInputEncoding             utf8
>     , withOutputEncoding            utf8
>     , withValidate                  yes
>     ]
> ------------------------------------------------------
>
> The file 'test_data-small.xml' contains the following data:
>
> ------------------------------------------------------
> <?xml version='1.0' encoding='UTF-8' ?>
>
> <contacts>
>
> <person>
>     <name>
>         <firstname>Max</firstname>
>         <lastname>M?ller</lastname>
>     </name>
> </person>
>
> </contacts>
> ------------------------------------------------------
>
> Note the umlaut in the lastname!
>
> If I run the program, I get the following error:
>
> ------------------------------------------------------
> error: UTF-8 encoding error at input position 127: ValueOutOfBounds
> ------------------------------------------------------
>
> Any help is appreciated. Thanks.
>
> --
> Greetings
> Elias
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Message: 3
Date: Sat, 27 Sep 2014 19:21:34 +0200
From: Elias Diem <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Hi Derek

On 2014-09-27,  Derek McLoughlin wrote:

> I just ran this (OS/X + Platform 2014 + hxt 9.3.1.7) and 
> it worked perfectly.

Good. Thanks.

> Are you sure that the XML file is actually saved with 
> UTF-8 encoding?

I *think* so. Vim tells me that it's UTF-8. I will double 
check.

> Can you attach it?

Here it is.

-- 
Greetings
Elias


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_data-small.xml
Type: application/xml
Size: 181 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140927/81b50920/attachment-0001.xml>

------------------------------

Message: 4
Date: Sat, 27 Sep 2014 19:41:21 +0200
From: Elias Diem <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

On 2014-09-27,  Elias Diem wrote:

> I *think* so. Vim tells me that it's UTF-8. I will double 
> check.

I just double checked. I'm 99% sure now that it is indeed 
UTF-8.

-- 
Greetings
Elias




------------------------------

Message: 5
Date: Sat, 27 Sep 2014 19:53:12 +0200
From: Elias Diem <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

On 2014-09-27,  Derek McLoughlin wrote:

> I just ran this (OS/X + Platform 2014 + hxt 9.3.1.7) and 
> it worked perfectly.

My version of HXT is 9.2.2.

I run Debian GNU/Linux stable.

-- 
Greetings
Elias




------------------------------

Message: 6
Date: Sat, 27 Sep 2014 22:12:37 +0100
From: Derek McLoughlin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID:
        <CAAw9fmnQwMWqXxAxq49sQmGYjHLhioONrzG=lt6vx0zppxf...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

That file ran fine for me.

I also tested it on a Cloud9 installation with GHC 7.6.3 and HXT 9.3
and it ran fine.

Also Ubuntu 14.04, GHC 7.6.3 and HXT 9.3 worked fine.

What's your default locale in Debian?

On my Mac and test Ubuntu box, it's:
LANG="en_IE.UTF-8"
LC_COLLATE="en_IE.UTF-8"
LC_CTYPE="en_IE.UTF-8"
...
all values = "C.UTF-8"

On my Cloud9 instance:

LANG=C
LANGUAGE=
LC_CTYPE="C.UTF-8"
...
all values = "C.UTF-8"

On 27 September 2014 18:53, Elias Diem <[email protected]> wrote:
> On 2014-09-27,  Derek McLoughlin wrote:
>
>> I just ran this (OS/X + Platform 2014 + hxt 9.3.1.7) and
>> it worked perfectly.
>
> My version of HXT is 9.2.2.
>
> I run Debian GNU/Linux stable.
>
> --
> Greetings
> Elias
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Message: 7
Date: Sun, 28 Sep 2014 09:57:28 +0200
From: Elias Diem <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] HXT: encoding problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Hi Derek

Thanks for your help so far.

On 2014-09-27,  Derek McLoughlin wrote:

> That file ran fine for me.

Ok.

> I also tested it on a Cloud9 installation with GHC 7.6.3 and HXT 9.3
> and it ran fine.
> 
> Also Ubuntu 14.04, GHC 7.6.3 and HXT 9.3 worked fine.

I will test it later this day on another computer as well.

> What's your default locale in Debian?
> 
> On my Mac and test Ubuntu box, it's:
> LANG="en_IE.UTF-8"
> LC_COLLATE="en_IE.UTF-8"
> LC_CTYPE="en_IE.UTF-8"
> ...
> all values = "C.UTF-8"
> 
> On my Cloud9 instance:
> 
> LANG=C
> LANGUAGE=
> LC_CTYPE="C.UTF-8"
> ...
> all values = "C.UTF-8"

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_COLLATE=
LC_CTYPE=

I haven't got any environment variables starting with LC 
defined.

-- 
Greetings
Elias




------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 75, Issue 22
*****************************************

Reply via email to