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.

 
 
LVL 1
fpoyavoAsked:
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:
0
tuttlepcCommented:
this might be silly, but make sure you have the field property set to nvarchar in your database...  
0
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.
0
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).

tuttlepcCommented:
hmmm... check regional and language options under control panel... make sure you have all necessary language and or supplemental language packs installed...
0
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.

0
tuttlepcCommented:
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
0

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:
Well...as 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 ?

Thanks.
0
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
FileStream
MemoryStream
StreamWriter and StreamReader
StringReader and StringWriter
0
tuttlepcCommented:
i've always used the StreamWriter and StreamReader
0
fpoyavoAuthor Commented:
Well I did that as well. The question is still opened.
0
tuttlepcCommented:
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...
0
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
C#

From novice to tech pro — start learning today.