Hi Raimund

On 20 Feb 2009, at 02:56, Raimund Dold wrote:

>
> Hi,
>
> sorry, but it is me again.
> Your example works for the testfile I provided in the mail but =20
> failed on th=3D
> e=3D20
> very next file I tested.
>
> The testfile (named testfile.dat) looks like this:
> =3D2D----------------------------
> "St=3DFCck/Nominale";"Bezeichnung"
> "4,636";"NAME"
> =3D2D----------------------------
>
> Just two lines to get clear results.
> If I read the file testfile.dat with the following line in R3
>
>>> dat: parse/all read %testfile.dat newline
> =3D3D=3D3D ["St=3DFCck/Nominale" {;"Bezeichnung"} "4,636" {;"NAME"} "" =
"" =20
> "" "" "=3D
> "]
>
>>> length? dat
> =3D3D=3D3D 9
>
> Using parenthis around the newline gives even stranger results:
>>> dat: parse/all read %testfile.dat {newline}
> =3D3D=3D3D ["St=3DFCck/Nominale" {;"B} "z" "" "ch" "u" {g"
> "4,636";"NAME"
>
>
>
>
>
> }]
>
>>> length? dat
> =3D3D=3D3D 7
>
>>> dat/2
> =3D3D=3D3D {;"B}
>
> Any more suggestions?
>
> Raimund

It seems that your data includes two field separators ";" within a =20
line of text and "newline" at the end of a line of text. You can =20
supply parse with a string of all the separators between your data:

 >> parse/all read %testfile.dat join ";" newline
=3D=3D ["Stock/Nominale" "Bezeichnung" "4,636" "NAME"]

In trying this out, it seems that the implicit to binary! conversion =20
in parse does not recognise utf-8 encoding.

 >> str: {"St=F6ck/Nominale";"Bezeichnung"}
=3D=3D {"St=F6ck/Nominale";"Bezeichnung"}

 >> write %utest.txt to binary! str
=3D=3D make port! [ .......

 >> to string! read %utest.txt
=3D=3D {"St=F6ck/Nominale";"Bezeichnung"}

 >> parse/all read %utest.txt ";"
=3D=3D ["St=C3=B6ck/Nominale" "Bezeichnung"]

Regards

Peter





-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to