how do i insert html file that have hebrew text and read it back in sql server 2008 using the filest

Posted by gadym on Stack Overflow See other posts from Stack Overflow or by gadym
Published on 2010-04-27T09:04:52Z Indexed on 2010/04/28 16:23 UTC
Read the original article Hit count: 254

hello all,

i am new to the filestream option in sql server 2008, but i have already understand how to open this option and how to create a table that allow you to save files. let say my table contains: id,name, filecontent

i tried to insert an html file (that has hebrew chars/text in it) to this table. i'm writing in asp.net (c#), using visual studio 2008.

but when i tried to read back the content , hebrew char becomes '?'.

the actions i took were:

1. i read the file like this:

        // open the stream reader
        System.IO.StreamReader aFile = new StreamReader(FileName,   System.Text.UTF8Encoding.UTF8);

        // reads the file to the end
        stream = aFile.ReadToEnd();

        // closes the file
        aFile.Close();

return stream; // returns the stream

  1. i inserted the 'stream' to the filecontent column as binary data.

  2. i tried to do a 'select' to this column and the data did return (after i coverted it back to string) but hebrew chars become '?'

how do i solve this problem ? what I should pay attention to ?

thanks, gadym

© Stack Overflow or respective owner

Related posts about hebrew

Related posts about filestream