法国和西班牙的特殊字符可以在varchar中保存吗

法国和西班牙的特殊字符可以在varchar中保存吗

本文介绍了法国和西班牙的特殊字符可以在varchar中保存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

法语和西班牙语中有特殊字符,通常的英语中不使用特殊字符(重音元音等)。

French and Spanish have special chars in them that are not used in normal English (accented vowels and such).

varchar中支持那些字符吗?还是我需要为它们使用nvarchar?

Are those chars supported in a varchar? Or do I need a nvarchar for them?

(注意:我确实要讨论是否应该使用nvarchar或varchar。)

(NOTE: I do NOT want a discussion on if I should use nvarchar or varchar.)

推荐答案

您在说什么SQL实现?

What SQL Implementation(s) are you talking about?

我可以谈论Microsoft Sql Server;

I can speak about Microsoft Sql Server; other SQL implementations, not so much.

对于Microsoft SQL Server,默认排序规则为 SQL_Latin1_General_CP1_CI_AS (拉丁语1常规,不区分大小写,区分重音)。它允许以单字节形式(varchar)而不是双字节形式(nvarchar)来西欧语言的往返表示。

For Microsoft SQL Server, the default collation is SQL_Latin1_General_CP1_CI_AS (Latin 1 General, case-preserving, case-insensitive, accent-sensitive). It allows the round-trip representation of most western European languages in single-byte form (varchar) rather than double-byte form (nvarchar).

它建立在 Windows 1252代码页上。该代码页实际上是ISO-8859-1,其代码点范围为0x80– 0x9F,由另一组字形表示,包括0x80处的欧元符号。 ISO-8859-1将代码点范围指定为控制字符,没有图形表示形式。

It's built on the "Windows 1252" code page. That code page is effectively ISO-8859-1 with the code point range 0x80–0x9F being represented by an alternate set of glyphs, including the Euro symbol at 0x80. ISO-8859-1 specifies that code point range as control characters, which have no graphical representation.

ISO-8859-1由Unicodes 基本多语言平面,覆盖8位字符(0x00– 0xFF)的整个域。有关详细信息和比较,请参见

ISO-8859-1 consists of the first 256 characters of Unicodes Basic Multilinigual Plane, covering the entire domain of an 8-bit character (0x00–0xFF). For details and comparison see






  • Unicode CO Controls and Basic Latin
  • Unicode C1 Controls and Latin-1 Supplement
  • Window 1252 Code Page
  • ISO-8859-1

西欧语言将很难此整理顺序包括(但不一定限于)拉脱维亚语,立陶宛语,波兰语,捷克语和斯洛伐克语。如果需要支持这些功能,则要么需要使用其他排序规则(SQL Server提供了很多排序规则),要么转向使用nvarchar。

Western European languages that will have a hard time with this collating sequence include (but aren't necessarily limited to) Latvian, Lithuanian, Polich, Czech and Slovak. If you need to support those, you'll either need to use a different collation (SQL Server offers a plethora of collations), or move to using nvarchar.

请注意,在数据库中混合排序规则往往会引起问题。

One should note that mixing collations within a database tends to cause problems. Deviating from the default collation should be done only when necessary and with an understanding of how you can shoot yourself in the foot with it.

我怀疑Oracle和DB2提供了类似的支持,只有在必要时才应偏离默认排序规则,并了解如何使用它。 。我不了解MySQL或其他实现。

I suspect Oracle and DB2 provide similar support. I don't know about MySQL or other implementations.

这篇关于法国和西班牙的特殊字符可以在varchar中保存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 19:09