| |

VerySource

 Forgot password?
 Register
Search
View: 1219|Reply: 13

Help! UTF-8 GB2312 format problem.

[Copy link]

1

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-12 16:00:01
| Show all posts |Read mode
To generate an aspx file as follows

<ASX version = "3.0">
  <Entry>
    <Ref href = "mms: //211.157.113.102/WMVideo/caifuzhoubao/ 郗 慧 林 .WMV" />
  </ Entry>
</ ASX>

The original file is indeed generated like this. But when you open the file in IE, it looks like this

<ASX version = "3.0">
  <Entry>
    <Ref href = "mms: //211.157.113.102/WMVideo/caifuzhoubao/ 閮 楁 收 鏋? WMV" />
  </ Entry>
</ ASX>

Why is this, how to solve it, brothers help!
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-6-6 21:00:01
| Show all posts
Post the code you generated?

You all talked about the format.
Reply

Use magic Report

1

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-6-7 19:30:01
| Show all posts
XmlDocument doc = new XmlDocument();

try
{
    string strXML = null;

    strXML = "<ASX version=\"3.0\">";

    for(int i = 0; i <myds.Tables[0].Rows.Count; i++)
   {
strXML += "<Entry>"
+"<Ref href=\""
+myds.Tables[0].Rows[i]["Path"].ToString()
+"\"/></Entry>";

}
The
strXML += "</ASX>";

doc.LoadXml(strXML);

doc.Save(fileName);
Reply

Use magic Report

3

Threads

26

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-6-8 10:30:01
| Show all posts
Code?
Reply

Use magic Report

1

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-6-8 18:00:01
| Show all posts
Yes, the above is the code!
Reply

Use magic Report

1

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-6-9 09:15:02
| Show all posts
The file name stored in the fileName above is the file path, and the content inside the file after the file is generated is

<ASX version="3.0">
  <Entry>
    <Ref href="mms://211.157.113.102/WMVideo/caifuzhoubao/Xi Huilin.WMV" />
  </Entry>
</ASX>

But after browsing, it becomes

<ASX version="3.0">
  <Entry>
    <Ref href="mms://211.157.113.102/WMVideo/caifuzhoubao/閮楁收鏋?WMV" />
  </Entry>
</ASX>
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-6-9 09:45:01
| Show all posts
doc.LoadXml(strXML);
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("bb.xml"), false, System.Text.Encoding.Default);

doc.Save(sw);
sw.Close();
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-6-9 10:30:01
| Show all posts
If not, change it to


System.Text.Encoding.Utf8
Reply

Use magic Report

1

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-6-9 20:00:02
| Show all posts
You seem to have opened this file with another editor?
Encoding is inconsistent

I have had this problem before

Make sure the text is good before browsing,
Then restart the computer, do not open it with other editors,
And don’t change the encoding
Reply

Use magic Report

1

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-6-9 20:45:01
| Show all posts
Ok, let me try!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list