Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^4: Parsing MS SQL CSV export with Text::CSV_XS

by andyford (Curate)
on Oct 22, 2008 at 21:49 UTC ( #718884=note: print w/replies, xml ) Need Help??

in reply to Re^3: Parsing MS SQL CSV export with Text::CSV_XS
in thread Parsing MS SQL CSV export with Text::CSV_XS

Perfect, that's the answer. Well part 1 anyway. I also needed to remove a CR (^@) from in between every character to get Text::CSV_XS to parse it.

I noticed a surprising thing: vim doesn't show the extra CR's in the original file with the "funny" lead two bytes. Remove them, and vim shows the CR's like this:

D^@A^@R^@K^@0^@1^@D^@G^@B^@B^@H^@1^@D^@,^@1^@5^@.^@5^@2^@.^@1^@3^@6^@. +^@2^@3^@7^@,^@2^@0^@0^@8^@-^@1^@0^@-^@2^@0^@ ^@1^@9^@:^@0^@0^@:^@0^@8 +^@.^@0^@0^@0^@,^@1^@,^@1^@.^@6^@.^@6^@0^@0^@0^@,^@8^@1^@.^@2^@.^@0^@. +^@2^@5^@,^@-^@W^@o^@r^@k^@s^@t^@a^@t^@i^@o^@n^@P^@a^@r^@e^@n^@t^@s^@^ +M^@
I wonder if vim recognizes it as a special file format.

Replies are listed 'Best First'.
Re^5: Parsing MS SQL CSV export with Text::CSV_XS
by ig (Vicar) on Oct 22, 2008 at 22:10 UTC
    Your file appears to be in unicode format. The leading FEFF bytes are the byte order mark

    You can probably save the file from SQL Server in a plain text format. If I remember correctly, output format ASCII txt will do this for some applications.

    Alternatively, you can have Perl read and translate the unicode.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718884]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2017-04-25 04:55 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (449 votes). Check out past polls.