Groups | Blog | Home
all groups > dotnet ado.net > october 2007 >

dotnet ado.net : UTF32 and XML Datatype


Evan Camilleri
10/16/2007 1:41:49 PM
I need to add a UTF32 xml file to an XML datatype (basically I want =
unicode characters in there)
is it possible?

When I do=20
SqlParameter x =3D new SqlParameter("@xmlX", SqlDbType.Xml); (i =
tried Text or Ntext in vain !!)
testclass t =3D new testclass();

t.Age =3D 32;
t.FirstName =3D "=DB=9D =DA=AE=DA=85=D9=B1=D9=8F=D8=B5=D8=9F =DB=9E";
t.LastName =3D "Silver";
t.Locality =3D "USA";

XMLSerializer<testclass> _serializer =3D new =
XMLSerializer<testclass>();
x.Value =3D _serializer.Serialize(t); (This gives me a UTF-32 XML =
file)
cmd.Parameters.Add(x);
cmd.ExecuteNonQuery();
I get an error : XML parsing: line 1, character 39, unrecognized =
encoding.

Evan Camilleri
10/16/2007 1:46:52 PM
I manged a workaround. UTF-16 (Unicode) was enough and it is the actual =
format of XML datatype in SQL2005.
[quoted text, click to view]
I need to add a UTF32 xml file to an XML datatype (basically I want =
unicode characters in there)
is it possible?

When I do=20
SqlParameter x =3D new SqlParameter("@xmlX", SqlDbType.Xml); (i =
tried Text or Ntext in vain !!)
testclass t =3D new testclass();

t.Age =3D 32;
t.FirstName =3D "=DB=9D =DA=AE=DA=85=D9=B1=D9=8F=D8=B5=D8=9F =
=DB=9E";
t.LastName =3D "Silver";
t.Locality =3D "USA";

XMLSerializer<testclass> _serializer =3D new =
XMLSerializer<testclass>();
x.Value =3D _serializer.Serialize(t); (This gives me a UTF-32 XML =
file)
cmd.Parameters.Add(x);
cmd.ExecuteNonQuery();
I get an error : XML parsing: line 1, character 39, unrecognized =
encoding.

AddThis Social Bookmark Button