Flat File Source Unicode

  • Hello,

    I need to identify if a flat file is Unicode or not by SSIS (Script Task). It's happens because sometimes the file's sponsor creates a file in a Windows format and sometimes he creates the file as Unicode.

    Thanks,

    Rewerson

  • rfugikawa (12/7/2009)


    Hello,

    I need to identify if a flat file is Unicode or not by SSIS (Script Task). It's happens because sometimes the file's sponsor creates a file in a Windows format and sometimes he creates the file as Unicode.

    Thanks,

    Rewerson

    This a bit tricky. I have created 2 samples with the Notepad - one unicode and one non unicode (they are attached). If you open the files in binary mode, you will see the unicode file contains two prefix bytes: FF FE

    I think you can use this as identifier, but it is important that the program which creates the file follow the guideline. Otherwise I don't see how you can possibly identify the file.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • You could try the code in this example: http://devhood.com/tutorials/tutorial_details.aspx?tutorial_id=469

    I think it would be far simpler to just add a Data Conversion task after your Flat File Source that converts fields to Unicode data types or vice-versa, regardless of the format of the source.

  • Have a look here

    http://unicode.org/faq/utf_bom.html

    The Byte Order Mark at the start of the file indicates the unicode encoding. You'll need to examine the first few bytes of the file.

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply