The ultimate solution to Chinese garbled characters in componentart.

Source: Internet
Author: User

Open the source code of componentart,

The accepted characters of componentart are encoded according to encode. Default, that is, the default encoding is used. We can change to UTF-8.

For example:

 

Protected void loadclientdata (string sdata)
{
String tempdata = sdata; // cache receiving characters
Try
{
If (sdata! = String. Empty)
{
This. nodes. Clear ();

Sdata = httputility. urldecode (sdata, encoding. Default );

// Make it XML-safe
Sdata = sdata. Replace ("&", "# $ camp @*");

Xmldocument oxmldoc = new xmldocument ();
Try {
Oxmldoc. loadxml (sdata );
}
Catch {
Sdata = httputility. urldecode (httputility. urldecode (tempdata, encoding. utf8 ));

Oxmldoc. loadxml (sdata); // do not change the originalCodeIn the catch, the value is UTF-8 encoded again.
}

Xmlnode orootnode = oxmldoc. documentelement;

If (orootnode! = NULL & orootnode. childnodes. Count> 0)
{
This. loadclientxmlnodes (orootnode. childnodes,-1, this. nodes );

// Fix up pointers
This. componentartfixstructure ();
}
}
}
Catch (exception ex)
{
Throw new exception ("error loading client data:" + ex );
}
}

 

The above Code comes from

basenavigator. CS has about 1400 rows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.