0

What collation should be use for ISO 8859-15 or ISO 8859-1 in SQL Server? I have looked around and cannot find references anywhere for this. Any help is greatly appreciated.

devmet
  • 95
  • 1
  • 8

1 Answers1

0

That entirely depends on which language you are going to store. E.g. if you use SQL_Danish_Pref_Cp1_CI_AS_KI_WI then Aarhus will be sorted after Xylophone since aa is a spelling of å, which is after x in the Danish/Norwegian alphabet.

thebjorn
  • 26,297
  • 11
  • 96
  • 138
  • We will be storing it in English. So, Is there a collation that can be used to validate character sets in ISO 8859-15 or ISO 8859-1 and reject any other characters? – devmet Jul 21 '15 at 21:13
  • Your question doesn't really make any sense.. The latin-1 character sets use the entire 256 possible encodings (i.e. there isn't a bit-pattern that represents an "illegal" character). All the cool kids are using utf-8, but if you're set on latin-1, then SQL_Latin1_General_Cp1_CS_AS_KI_WI might work for you, or one of the Cp437 collations if your English is USian, maybe one of the Cp850 if your English is "Original" ;-) Seriously though... utf-8 :-) – thebjorn Jul 21 '15 at 21:48
  • We are trying to feed data to a system that only accepts ISO 8859-15 characters. So I'm trying to use collation in SQL server to validate the characters before feeding it. I guess I'll try SQL_Latin1_General_Cp1_CS_AS_KI_WI and see where I get. – devmet Jul 21 '15 at 22:11
  • As I said, I think you're misunderstanding what a collation is (it has nothing to do with invalid "characters"). What you are doing is trying to take input bytes and store them as 8859-15 bytes. To do that, you'll need to know which encoding the input bytes are, so that you can decode the bytes to Unicode. Once you have Unicode text, you'll need to encode it as iso-8859-15 and deal with any Unicode code points ("characters") that cannot be encoded using that encoding. If you haven't read http://www.joelonsoftware.com/articles/Unicode.html yet, it's a good place to start. – thebjorn Jul 21 '15 at 23:48