| |

VerySource

 Forgot password?
 Register
Search
View: 643|Reply: 4

Convert string to stream, stream to string

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-6 19:30:01
| Show all posts |Read mode
As the title, if there is Chinese in the string, how to convert it? Thank you ~
Reply

Use magic Report

0

Threads

14

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-26 22:00:02
| Show all posts
System.Text.Encoding.GetEncoding (936) .GetBytes (string);
Reply

Use magic Report

0

Threads

52

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-3-27 22:00:01
| Show all posts
string s = "Hello everyone!";
Ranch
byte [] buffter = System.Text.Encoding.GetEncoding (936) .GetBytes (s);

string ss = System.Text.Encoding.GetEncoding (936) .GetString (buffter, 0, buffter.Length);
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-1 18:15:01
| Show all posts
Thank you, by the way, what is this 936? GB2312? Why not use GB2312 directly?
Reply

Use magic Report

0

Threads

52

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-4-4 00:45:01
| Show all posts
string s = "Hello everyone!";
Ranch
byte [] buffter = System.Text.Encoding.GetEncoding ("GB2312"). GetBytes (s);

string ss = System.Text.Encoding.GetEncoding ("GB2312"). GetString (buffter, 0, buffter.Length);

Thank you!
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