c# - Correcting text in database? -


question:

in 1 of database, there value in varchar-field: brokers méxico, intermediario de aseguro,s.a.

now make new column nvarchar, , want take on old values, encoded.

now 2 questions:

a)
in c#/vb.net, how can change méxico proper value ("méxico"), before storing in unicode field (assuming know proper source-codepage)?

b)
there way figure out codepage, if don't want manually ? (well, asking free, suppose there none).

you might want try this:

string broken = "brokers méxico, intermediario de aseguro,s.a."; // text database byte[] encoded = encoding.getencoding(28591).getbytes(broken); string corrected = encoding.utf8.getstring(encoded); 

it depends on how it's been inserted - that's assuming has taken utf-8 bytes, interpreted them iso-8859-1 string, , inserted string database. code performs same conversion in reverse.

i'm not sure figuring out code page - guess @ iso-8859-1 , utf-8 start with, , if doesn't work, @ examples of what's wrong , correct version.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -