简体   繁体   English

python utf-8字符支持中以`\\ U`和`\\ u`开头的unicode字符有什么区别

[英]what is the difference between unicode characters starting from `\U` and `\u` in python utf-8 characters support

I have 2 strings, both of which translates to the same thing in the end but in one of the representation, mysql adds the data to the db; 我有2个字符串,两个字符串最终都转换为相同的东西,但是在其中一种表示形式中,mysql将数据添加到db中。 in other, it doesn't. 另一方面,事实并非如此。

  1. \?\?\?\?
  2. \\U0001f1fa\\U0001f1f8

I am not able to figure out the difference between these two representations and the reason for 1 format supporting data addition in mysql. 我无法弄清楚这两种表示形式之间的区别,以及1种格式支持mysql中数据添加的原因。 Mysql connection is open in utf-8 mode. Mysql连接以utf-8模式打开。

\\U is 32-bit and followed with 8 hex digits, when \\u\u003c/code> is 16-bit and followed by 4 digits. \\U是32位,后跟8个十六进制数字,而\\u\u003c/code>是16位,后跟4个数字。 See ' https://docs.python.org/3/howto/unicode.html ' for example. 例如,请参见“ https://docs.python.org/3/howto/unicode.html ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python str(u'a')和u'a'.encode('utf-8')有什么区别 - Python what's the difference between str(u'a') and u'a'.encode('utf-8') python中u''前缀和unicode()有什么区别? - What is the difference between u' ' prefix and unicode() in python? Python unicode字符串文字::'\ u0391'和u'\ u0391'之间的区别是什么 - Python unicode string literals :: what's the difference between '\u0391' and u'\u0391' 在python中将unicode字符转换为utf-8 - Convert unicode characters to utf-8 in python Python正则表达式模块“re”将Unicode字符与\\u匹配 - Python regex module "re" match unicode characters with \u Web爬行:使用-o file.json将文件保存为utf-8:输出显示像\\ u00a9这样的字符 - Web crawling: python saving file with -o file.json as utf-8: the output shows characters like \u00a9 Python Jupyter Notebook:如何从Wikipedia十六进制值(如U + 1F0A1)打印Unicode字符? - Python Jupyter Notebook: How to print unicode characters from wikipedia hex value (like U+1F0A1)? 蟒蛇。 unicode + variable和u + constant之间的区别? - Python. Difference between unicode+variable and u+constant? 打印带有UTF-8编码字符的字符串,例如:“ \\ u00c5 \\ u009b \\” - Printing strings with UTF-8 encoded characters, e.g.: “\u00c5\u009b\” 将Unicode字符解码并编码为'\\ u ####' - Decode and encode unicode characters as '\u####'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM