草庐IT

multibyte-characters

全部标签

mysql - 哪个更好 : storing string including Unicode characters in NVARCHAR or VARCHAR?

这个问题在这里已经有了答案:Whatisthedifferencebetweenvarcharandnvarchar?(21个回答)关闭9年前。我想存储包含Unicode字符的字符串。我知道有两个选择。NVARCHAR和VARCHAR。NVARCHAR使用2个字节存储一个字符;但是VARCHAR对一个字符使用1个字节。就存储2个2字节的unicode字符而言,每个字符使用4个字节。但是当涉及到存储1个1字节的ansi字符和1个2字节的unicode字符时,NVARCHAR使用4个字节,而VARCHAR使用3个字节。所以我认为使用VARCHAR更紧凑并且始终是更好的方法。我不知道我上面的

mysql2 gem、Rails 3.0.3 和 "incompatible character encodings"错误

我正在使用Rails3.0.3,我已经将mysql适配器从ruby​​-mysql更改为mysql2,但现在出现以下错误:incompatiblecharacterencodings:ASCII-8BITandUTF-8我到处都读到过这方面的内容,但我无法设法修复它。application.rb:config.encoding="utf-8"数据库.yml:development:adapter:mysql2encoding:utf8database:rails3_developmentusername:rootpassword:host:localhostgem:specs:abst

php - 插入数据库问题... (Bad character coding) PHP/MYSQL

我有一个提交到mysql数据库的表单。数据库设置为UTF-8_GENERAL,行也使用相同的字符编码。但是当我提交文本中带有“ő”或“ű”的表单时,它不会在这些字符之后提交任何内容。(例如:“这是美好的一天。”它只是将其插入数据库:“这是美好的一天”)表单验证页面有mysql_real_escape_string();剥离标签();在提交给数据库之前。我该如何解决这个问题?任何帮助表示赞赏... 最佳答案 很好,你正在使用mysql_real_escape_string()!我认为问题可能在于,在某些侧步表单页面->头文件->核心文

mysql 结果是 "special character"-insensitive

似乎当我更改一个mysql表(在utf-8表/列上)唯一时,它返回重复输入错误。例子:ALTERTABLEnameADDUNIQUE(name)错误:Duplicateentry'Adé'forkey'name_UNIQUE'我认为这是因为followtorowsinmydatabaseAde,Adé是否可以用特殊字符改变唯一的表?谢谢,鲍勃 最佳答案 您需要设置collation在列(或整个表或数据库——我不认为连接范围适用于唯一约束)到尊重“e”和“é”之间差异的范围。参见here有关不同排序规则设置可能产生的影响的示例。假设您

C# : Unable to print data as unicode characters from MYSQL database

您好,我开发了一个Windows应用程序,允许用户以泰米尔字体保存数据和查看数据。我安装了“Bamini”字体(泰米尔语字体),并将文本框和数据GridView设置为Bamini字体。我可以用泰米尔语保存和检索数据。问题是我输入的泰米尔语数据已编码并保存在数据库中例如:如果我在文本框中输入'இந்தியா'并保存,它在mysqldb中保存为“,e;j_ah”(我已将列字符集设置为utf8)。因此,当我获取数据并尝试打印时,打印的是“,e;j_ah”而不是“இந்தியா”。谁能告诉我我做错了什么?!我用来插入字符串的代码:textBox1的值为“இந்தியா”(因为文本框字体设置为“

mysql - 错误 1115 (42000) 在第 29 行 : Unknown character set: 'utf32'

我正在尝试将一个mysqldump文件导入到我的本地数据库中。我正在使用以下命令mysql5-uroot-pfbpj出现如下错误ERROR1115(42000)atline29:Unknowncharacterset:'utf32'__下面是转储中抛出错误的部分,位于最底部。我对可能发生的事情感到困惑。--phpMyAdminSQLDump--version3.4.11.1--http://www.phpmyadmin.net----Host:localhost--GenerationTime:Mar02,2013at03:49PM--Serverversion:5.5.23--PHP

MySQL : Find the last occurrence of a character in a string

LengthwillbedynamicandiwanttofindthedatabeforelastoccurrenceofacharacterinastringinMYSQL类似于php中的strrchrTogetlastoccurrenceof_(underscore)Ineedtopasslength.andhereit's3mysql>SELECTSUBSTRING_INDEX('this_is_something_here','_',3);+----------------------------------------------------+|SUBSTRING_INDE

python - 统一码编码错误 : 'latin-1' codec can't encode character u'\u2014'

我收到此错误UnicodeEncodeError:'latin-1'codeccan'tencodecharacteru'\u2014'我正在尝试将大量新闻文章加载到MySQLdb中。但是我在处理非标准字符时遇到了困难,对于各种字符,我遇到了数百个这样的错误。我可以使用.replace()单独处理它们,尽管我想要一个更完整的解决方案来正确处理它们。ubuntu@ip-10-0-0-21:~/scripts/work$pythontest_db_load_error.pyTraceback(mostrecentcalllast):File"test_db_load_error.py",l

php - MySQL 和 PHP : UTF-8 with Cyrillic characters

这个问题在这里已经有了答案:UTF-8allthewaythrough(13个答案)关闭2年前。我想在MySQL表中插入一个西里尔字母值,但是编码有问题。PHP:connect_error){die("Connectionfailed:".$conn->connect_error);}$sql="UPDATE`c`.`mainp`SET`search`='testтест'WHERE`mainp`.`id`=1;";if($conn->query($sql)===TRUE){}$conn->close();?>MySQL:|id|search||1|testав|注意:PHP文件为

php - SQLSTATE[42000] : Syntax error or access violation: 1064 default character set utf8 collate utf8_unicode_ci' at line 1

这个问题在这里已经有了答案:Syntaxerrororaccessviolationerrorwhilerunning"phpartisanmigrate"formigrationfilecontainingprimary&foreignkeys(2个答案)关闭去年。我正在尝试将此代码迁移到mysql数据库中,但不断收到此错误消息。SQLSTATE[42000]:Syntaxerrororaccessviolation:1064YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserververs