Windows 商店的 Sqlite 不搜索阿拉伯语文本 [英] Sqlite for windows store doesn't search for arabic text

查看:33
本文介绍了Windows 商店的 Sqlite 不搜索阿拉伯语文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 8 商店应用中使用 sqlite.我已经成功查询了很多东西,但最近我尝试执行以下查询:

I am using sqlite for my windows 8 store app. I've been querying a lot of things successfully, but recently i tried to do the following query:

SELECT * FROM QuranText where AyaWithoutTashkeel LIKE '%الم%'

这总是返回 0 结果,对于任何阿拉伯文本都是一样的,但是当文本是英文时:

This always returns 0 results and the same for any arabic text, however when the text is English:

SELECT * FROM Translation where TranslationText LIKE '%all%'

它是有效的,它返回结果.

it's valid and it returns results.

当然,我确信数据库本身具有相同的值和所有内容.但是,我的另一个应用程序(WP8 应用程序)在两个查询中都返回结果.使用相同的 .sqlite 数据库,当然也使用 sqlite.

of course I'm sure that the database itself has the same values and everything. My other app (a WP8 app) however returns results in both queries. using the same .sqlite database and using sqlite of course.

我在想这可能是一种编码问题?

I'm thinking it's a kind of encoding problem maybe?

推荐答案

经过多次尝试,我们得出了解决方案.显然,SQL 数据库上的 SQLlite 层仅在以如下参数化查询样式输入时才识别阿拉伯字母:

After a lot of trials, we came to the solution to this. Apparently the SQLlite layer over the SQL database only recognize Arabic letters when it's entered in a parameterized query style like this:

//define your connection here
static SQLite.SQLiteConnection dbConn = = new SQLite.SQLiteConnection(file.Path);
//in your method that makes the call:
string text="الم";
dbConn.Query<DB.QuranText>(@"SELECT * FROM QuranText where AyaWithoutTashkeel LIKE", "%" + text + "%");

这是唯一有效的方法.

这篇关于Windows 商店的 Sqlite 不搜索阿拉伯语文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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