如何使用 Squirrel Sql 插入亚洲字符
我在 Ubuntu 上运行 Squirrel-SQL。
我无法在 Squirrel 上写中文字符,但我可以在另一个文本编辑器中编写它们并复制+粘贴到 Squirrel 中。但是,当我运行更新并选择刚刚插入的数据时,我编写的字符显示为问号。
当我从网络界面插入数据时,或者当我右键单击结果并选择“使其可编辑”时,我可以粘贴数据,当我再次选择时,这些数据将正常显示。
这告诉我数据库可以很好地保存字符。松鼠能够很好地表现人物。问题似乎出在 sql 文本编辑器中。
以前有人遇到过这个问题吗?
I'm running Squirrel-SQL on Ubuntu.
I cannot write chinese characters on Squirrel, but I can write them in another text editor and copy+paste into squirrel. However, when I run the update and select the data I just inserted, the characters I write show up as question marks.
When I insert the data from a web interface, or when I right click on results and choose "make editable", I can paste in the data which will show up fine when I select again.
This tells me that the database saves the characters fine. Squirrel is capable of displaying the characters fine. The problem seems to be in the sql text editor.
Anyone have this problem before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到答案了!看起来 hibernate 正在为我做一些额外的工作(通过网络界面或松鼠的“使结果可编辑”选项),我不知道这是必要的。看起来这个问题实际上是 Microsoft SQL Server 的语法错误。我需要在要插入的字符之前添加字母“N”。
例如:
更新标题_产品
set synopsis = N'我很高兴测试'
其中 title_product_id = 26
这会正确转换中文和英文字符。耶。
虽然我仍然无法直接在 Squirrel 中写入汉字,但我必须从另一个编辑器复制+粘贴。
I finally found the answer! Looks like hibernate was doing some extra work for me (via web interface or squirrel's "make editable" option on results) that I wasn't aware was necessary. Looks like the problem was actually a syntactical mistake for Microsoft SQL Server. I needed to prepend the letter 'N' right before the characters I wish to insert.
For example:
update title_product
set synopsis = N'我很高兴 test'
where title_product_id = 26
This converts chinese and english characters correctly. Yay.
Although I still cannot write chinese characters directly into Squirrel, I have to copy+paste from another editor.