0

I have a large localization system that contains translations for 26 languages, two of which are right to left (Arabic and Hebrew). Test found a few defective strings in the software deliverable that were traced back to the translators (not including the RTL marker in the appropriate location in the string). I happened to be in my IDE at the time and wrote a quick console app using EF to generate a list of all of the strings recently translated which were missing the maker (\u200f) to expedite the investigation as not all strings require them.

In an effort to add this to our QA process down the road, I wanted to create a stored procedure to perform the query. For the life of me I cannot get it to work and cannot find any documentation on querying against the character.

What I have found is that the RTL marker is NCHAR(8207) in Unicode codepoint or NCHAR(0x200F) in hex. My database collation is SQL_Latin1_General_CP1_CS_AS.

However, a query like:

declare @RTLM nchar
set @RTLM = NCHAR(8207)


  SELECT [Translation]
  FROM [dbo].[Translations]
  where Translation like '%' + @RTLM +'%'

GO

Returns every string in the table, regardless of whether or not it includes the RTL marker. The same query works fine if I am looking for a printable character in the query. The same behavior is present for the hex version NCHAR(0x200F).

Does anyone have any thoughts on what could be happening?

4

1 回答 1

0

疯狂地猜测这可能是 SQLServer 的运算符 LIKE 对那些特殊字符的限制。

作为替代路径,我建议您使用 CHARINDEX 函数而不是 LIKE 运算符重写您的查询。

于 2013-10-03T21:04:41.373 回答