<\/script>')

Why does the CHARINDEX function return the index for "Œ" in the "maneuver" of the string?

I have this SQL code

declare @s varchar(8000) = 'manoeuvre' select CHARINDEX(char(140), @s, 0) 

char (140) = Œ which dose does not exist in string maneuvers. but the SQL server returns the following

4 (indicating that he found char (140) on this line)

If I replaced 'Œ' with '*', I get

man * uvre

it looks like SQL replaced "o" and "e" with one character, but why? why does it replace "oe" with "Œ"?

the same effect can be seen with the string 'mass' and 'ß' (which, I believe, is German for double s). replacing on this character, returns sting 'ma *'.

Is SQL an attempt to do something smart under covers?

EDIT Additional information:

SQL Server 2008 R2

The database mapping is Latin1_General_CI_AS.

+4
source share
1 answer

If you look at this sign (ASCII 140), it is described as

capital OE ligature

See www.table-ascii.com for example

to try

 select CHARINDEX(char(140), @s COLLATE Latin1_General_BIN, 0) 

which will perform a binary search.

+3
source

Source: https://habr.com/ru/post/1416375/


All Articles