如何订购包含变音符号和其他特殊字符的 SQLite 结果? [英] How to order SQLite-results containing umlauts and other special characters?

查看:17
本文介绍了如何订购包含变音符号和其他特殊字符的 SQLite 结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据德语使用的规则对来自 ​​SQLite 的结果进行排序.这意味着像""这样的字符被视为ae",或者""像ue"一样.

I would like to order my results from SQLite according to the rules used for German. This means a character like "�" is treated like "ae", or "�" like "ue".

此时的解决方案如下:

SELECT * FROM data ORDER BY REPLACE(REPLACE(REPLACE(UPPER(einrichtung),'�','AE'),'�','OE'),'�','UE') LIMIT 0,20

该解决方案不应涉及安装更多工具或修改 SQLite 服务,因为该项目应在部署的任何地方开箱即用".

The solution should not involve installing more tools or modifying the SQLite service, because this project should run "out of the box" wherever it will be deployed.

推荐答案

您必须在 UTF-8/UTF-16 中执行所有操作.例如,如果您正在处理 PHP,那么您还可以使用 utf8_encode/utf8_decode.

You have to do everything in UTF-8/UTF-16. If you are dealing with PHP for example you have also work with utf8_encode/utf8_decode.

另见http://www.sqlite.org/pragma.html#pragma_encoding

(我知道这个问题很老了,但人们仍然在正确编码方面遇到问题.)

这篇关于如何订购包含变音符号和其他特殊字符的 SQLite 结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆