规范化 SQL Server 中的 unicode 字符串? [英] Normalize unicode string in SQL Server?

查看:35
本文介绍了规范化 SQL Server 中的 unicode 字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server 中是否有规范化 unicode 字符串的函数?例如

Is there a function in SQL Server to normalize a unicode string? e.g.

UPDATE Orders SET Notes = NormalizeString(Notes, 'FormC')

Unicode 规范化形式:

Unicode Normalization Forms:

  • C​组合(C):A + ¨ 变为 Ä
  • D​ecomposition (D): Ä 变成 A + ¨
  • 兼容组合(KC):A + ¨ + fi + n 变成 Ä + f + i + n
  • 兼容分解(KD):Ä + fi + n变成A + ¨ + f + i + n
  • C​omposition (C): A + ¨ becomes Ä
  • D​ecomposition (D): Ä becomes A + ¨
  • Compatible Composition (KC): A + ¨ + + n becomes Ä + f + i + n
  • Compatible Decomposition (KD): Ä + + n becomes A + ¨ + f + i + n

我找不到任何内置函数,所以我假设没有.

i cannot find any built-in function, so i assume there is none.

理想情况下,如果只能有一个,那么我今天恰好需要Form C:

Ideally, if there can be only one, then i happen to need Form C today:

Unicode 规范化形式 C,规范组合.将每个分解的分组(由一个基本字符加上组合字符组成)转换为规范的预组合等价物.例如,A + ¨ 变成 Ä.

Unicode normalization form C, canonical composition. Transforms each decomposed grouping, consisting of a base character plus combining characters, to the canonical precomposed equivalent. For example, A + ¨ becomes Ä.

另见

  • Windows 中的 Unicode 规范化
  • 如何删除变音符号(重音) 来自 .NET 中的字符串?
  • NormalizeString 函数
  • 整理一下:SQL Server 使用什么规范化形式
  • 推荐答案

    抱歉,不,迄今为止的任何版本的 SQL Server(2012 测试版本)中都没有这样的功能.比较可以正确地对组合不敏感,但没有将字符组合用法转换为一种正常形式的功能.

    Sorry, no, there is no such function in any version of SQL Server to date (2012 test builds). Comparisons can be correctly composition-insensitive, but there isn't a function to convert character composition usage to one normal form.

    已建议在语法 NORMALIZE(string, NFC) 下为未来版本的 ANSI 标准提供,但要在现实世界中实现它还需要很长时间.目前,如果您想进行规范化,您必须使用具有更好字符串处理能力的适当编程语言来完成,方法是从数据库中提取字符串或编写 CLR 存储过程来完成.

    It has been suggested for a future version of the ANSI standard under the syntax NORMALIZE(string, NFC) but it's going to be a long time before this makes it to the real world. For now if you want to do normalisation you'll have to do it in a proper programming language with better string-handling capabilities, either by pulling the string out of the database or by writing a CLR stored procedure to do it.

    这篇关于规范化 SQL Server 中的 unicode 字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆