December 7, 2009 at 9:38 am
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
December 7, 2009 at 10:06 am
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.
December 7, 2009 at 10:22 am
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.
December 7, 2009 at 10:26 am
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/61537Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply