views:

63

answers:

3

If I try to create a select with special (nordic) characters like:

Select * from users where name like '%æ%'

It just selects all users instead of those containing the letter 'æ'.

Do I need to install some special drivers to the database, or is there something else I have missed?

Update:
I am using a SQL Server 2008 database, the collation is set to 'SQL_Latin1_General_CP1_CI_AS' and the datafield is a nullable nVarChar datatype.

A: 

Make sure you're using an extended character set (UTF-8) and you should be fine.

Josh K
A: 

it should be work correctly ..
but try this Select * from users where name like '%[æ]%'

Space Cracker
It works, but I can't manually escape the variables, since it is a search input.
Dofs
I use NHibernate which uses parameters for search input, so it should be working against sql injection.
Dofs
+3  A: 

Most likely some collation or datatype issue

Example, gives 97 and 230

SELECT ASCII('æ' COLLATE Albanian_CI_AI), ASCII('æ' COLLATE Latin1_General_CI_AS) 

We'll need more info basically.

Edit: Question about Danish/Norwegian å (although unresolved)

Edit 2: change the code to this if name is nvarchar so the literal becomes unicode too.

Select * from users where name like N'%æ%'
gbn