Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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.


Comment on Re^4: Parsing MS SQL CSV export with Text::CSV_XS
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718884]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (22)
As of 2015-07-06 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls