1
|
byte
[] byte_in = Encoding.UTF8.GetBytes(
"黄仕"
);
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
static
string
EncodeQuoted(
byte
[] str)
{
StringBuilder res =
new
StringBuilder();
for
(
int
i = 0; i < str.Length; i++)
{
if
(str[i] >=
'!'
&& str[i] <=
'~'
&& str[i] !=
'='
)
{
res.Append(str[i]);
}
else
{
res.Append(
"="
);
res.Append(((
byte
)str[i]).ToString(
"X"
));
}
}
return
res.ToString();
}
|