When using Entity Framework to search the database, accents are ignored.

c# entity-framework non-ascii-characters

Question

I have names with accented characters in a database table. Likeä so on.

I need to use EF4 to get all entries from a table with the substring whatever the accents.

Consequently, this code:

myEntities.Items.Where(i => i.Name.Contains("a")); 

should provide each object whose name containsa , but also anything that containsä , â so on. Can this be done?

1
14
6/15/2011 12:01:44 PM

Accepted Answer

The queries should function as needed if you use an accent-insensitive collation order on the Name column.

14
6/15/2011 12:38:00 PM

Popular Answer

The issue will be resolved by setting an accent-insensitive collation.

With the below query, you may modify the collation for a column in SQL Server and Azure databases.

ALTER TABLE TableName
ALTER COLUMN ColumnName NVARCHAR (100)
COLLATE SQL_LATIN1_GENERAL_CP1_CI_AI NOT NULL

SQL_LATIN1_GENERAL_CP1_CI_AI is the compilationLATIN1_GENERAL is British (United States),CP1 is 1252 code page.CI is not case-sensitive,AI is not sensitive to accent.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow