READ unicode text file insert into MS SQL 2005

Hi Experts,

I am really tired :) of trying a number iof things. Here is my problem.

1] I have file which is text / html.
2] This file contains KOI8-R characters and as I understand its Unicode.
3] I am trying to read it using StreamReader sr = new StreamReader(file);
     and then

   while ((read = sr.ReadLine()) != null)
                  { ...........}

4] The application opens it and reads fine but I loose original content menaing when I read and write
    line to some output I am not getting what is in input file.

   I tried also some decoding / encoding but why should I in the first place :) if the only thing I need is to read this KOI8-R file and write original data into output file or may be insert into  SQL 2005 ?

In other words I would get original data from input having KOI-8 (Unicode 650001) into my output file or SQL 2005 table.

I am lost completely.

Please help.

Thank you in advance.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fpoyavoAuthor Commented:
this might be silly, but make sure you have the field property set to nvarchar in your database...  
fpoyavoAuthor Commented:
I do :) have nvarchar and when I insert and then select from this column I am not getting original content
meaning its somehow decoded or encoded not sure. I can see some unreadable characters and a bunch of commas, digits and special characters but text is not there.
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

hmmm... check regional and language options under control panel... make sure you have all necessary language and or supplemental language packs installed...
fpoyavoAuthor Commented:
Hi tuttlepc,

Woudl you be more specific. I do have KOI8-R enabled and I can see it in MS Word.
In terms of language packs I would ask again why would I if I don't conver it. I just need to
read it as RAW data and write it the way it is. :)

Thanks a lot.

hmmm...  sounds like we need a db admins input on this one...  might have something to do with the way your sql server is setup

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fpoyavoAuthor Commented: I have mentioned it not only SQL. When I am writing input line by line to some output file
I see exactly same problem. It means it happens at the time C3 win app reads it or may be I am not reading correctly ?

fpoyavoAuthor Commented:
As far as I know there are few methods of reading input file : Which one will do the job ?

Binary Reader and Writer
Directory, File, DirectoryInfo, and FileInfo
StreamWriter and StreamReader
StringReader and StringWriter
i've always used the StreamWriter and StreamReader
fpoyavoAuthor Commented:
Well I did that as well. The question is still opened.
can you post another example of what your expected output would be, and then the result let's say if you were to write it out to a pop up window msg box... or a variable in debug mode what it's showing....

exactly what you've read then exactly what it spits out...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.