如何解决"base64无效字符"?错误? [英] How can I solver an "base64 invalid characters" error?
问题描述
当我尝试使用以下代码将value1转换为byte []时:
When I m trying to convert the value1 to byte[] using the following code:
string value1 = "4rdHFh%2BHYoS8oLdVvbUzEVqB8Lvm7kSPnuwF0AAABYQ%3D";
byte[] value2 = Convert.FromBase64String(value1);
我收到一个错误,指出字符串内容无效的base-64字符...
Ι received an error that the string contents invalid base-64 characters...
怎么了?
谢谢!
推荐答案
来自
s由基数64位数字,空格字符和结尾
填充字符. 从零开始的64位基数升序
是大写字符"A"至"Z",小写字符"a"至
"z",数字"0"到"9"以及符号"+"和"/" .
s is composed of base 64 digits, white space characters, and trailing
padding characters. The base 64 digits in ascending order from zero
are the uppercase characters 'A' to 'Z', lowercase characters 'a' to
'z', numerals '0' to '9', and the symbols '+' and '/'. 这篇关于如何解决"base64无效字符"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
%
不允许采用 base64
编码.%
is not allowed in base64
encoding.Value Char
0 A 16 Q 32 g 48 w
1 B 17 R 33 h 49 x
2 C 18 S 34 i 50 y
3 D 19 T 35 j 51 z
4 E 20 U 36 k 52 0
5 F 21 V 37 l 53 1
6 G 22 W 38 m 54 2
7 H 23 X 39 n 55 3
8 I 24 Y 40 o 56 4
9 J 25 Z 41 p 57 5
10 K 26 a 42 q 58 6
11 L 27 b 43 r 59 7
12 M 28 c 44 s 60 8
13 N 29 d 45 t 61 9
14 O 30 e 46 u 62 +
15 P 31 f 47 v 63 /