c# sqlite encoding utf8 -


i have strange problem (i have searched - common problem, don't find working solution).

i'm using c# (.net 4.0) , sqlite. pragma encoding shows me utf8, want save data in encoding. tried use somelike this:

     private string toutf8(string input) {          encoding ecdng = encoding.default;          byte[] bts = ecdng.getbytes(input);         ecdng = encoding.utf8;         return ecdng.getstring(bts, 0, bts.length);         //return input;     }      private string fromutf8(string input)     {          encoding ecdng = encoding.utf8;          byte[] bts = ecdng.getbytes(input);         ecdng = encoding.default;         return ecdng.getstring(bts, 0, bts.length);         //return input;     } 

but doesn't work. use toutf8 when i'm going save data , fromutf8 when selecting data.

second solution found is:

        private idbdataparameter addparameter(idbcommand command, string paramname, dbtype type, object value)     {         idbdataparameter parameter = command.createparameter();         parameter.parametername = paramname;         parameter.dbtype = type;         if (value != null)             parameter.value = value;         else             parameter.value = dbnull.value;         command.parameters.add(parameter);         return parameter;     } 

but doesn't work too.

i want store in database polish words. when preview data via sqlitestudio have strange symbols in place of polish letters. in program have same problem, other symbols on polish letters.

can me this?

best regards, matt.

solved. read data file - using readalllines encoding utf8, when change default have polish letters :)


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -