[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2828
  • Last Modified:

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.

 
 
0
fpoyavo
Asked:
fpoyavo
  • 6
  • 5
1 Solution
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now