首页 > 解决方案 > 错误:“不兼容的字符编码:ASCII-8BIT 和 UTF-8”和“UTF-8 中的无效字节序列”在 SQL Server 2008 R2 中创建记录 RoR 时

问题描述

标签: ruby-on-railssql-serverutf-8character-encodingruby-1.9.2

解决方案


After research for a long time, I found that the windows encoding is the problem.
I released that I can't input symbol such as "✓". It return the same error. And then I tried to trace what input in SQL profiler will transfer to database table, it same as "✓". But it should be encoded of "✓" (I had check the value also in my local).
After research and googling for a long time, I found this post https://superuser.com/questions/336197/unicode-characters-suddenly-start-displaying-as-boxes-in-some-applications?newreg=8b561b87000d4e79b20cbea9c3d2eb07

I tried it and restart the PC. and my application can save "✓" or Chinese character again. It saved become encoded string to database.
(I'm still looking for the reason, how come the windows unicode is the root of this problem)


推荐阅读