如何检查我的Oracle数据库中是否正确设置了商标(™)字符? [英] How can I check that the trademark(™) character is set correctly in my Oracle database?

查看:621
本文介绍了如何检查我的Oracle数据库中是否正确设置了商标(™)字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查我的Oracle数据库中是否正确设置了商标(™)字符?



我希望使用UTF-8编码存储。 / p>

我有一个值存储在Salesforce.com字段,从GUI看起来像这样(注意商标字符):

  Chuck Norris的Roundhouse Kick™

使用Informatica将其复制到Oracle数据库。我的数据库设置为使用AL32UTF8编码。



如何在SQL Developer中显示



我的表使用SQL Developer,商标符号显示为一个矩形(黑色边框,白色填充)。





当我将使用UTF-8编码从SQL Developer导出到HTML文档中,并在Chrome中打开它时,商标符号不会出现。当我在IE中打开它,它再次显示为一个矩形。在Firefox中,它是一个矩形,上半部分为 00 ,下半部分为 99 。所有三个浏览器都使用UTF-8解释HTML文档。



如何在文本编辑器中显示



在记事本和记事本++中的同一个HTML文档,商标符号显示为一个矩形。如果我使用Hex Viewer插件为Notepad ++我看到字节编码是 C2 99 。这似乎是UTF-8中的商标符号的正确编码< a>。



当我在MS Write中打开文档时,商标字符看起来像这样:™ / p>

当我以编程方式获取值



使用Python,当我从数据库获取值时,替换为\xbf - 反向问号,但 字符甚至没有被正确编码,因为它至少缺少一个前导字节(取决于具体的编码)

 >>> import cx_Oracle 
>>>> con = cx_Oracle.connect('username','password','db')
>>> cur = con.cursor()
>>>> cur.execute('select * from trademark')
< __ builtin __。OracleCursor on< cx_Oracle.Connection to username @ db>>
>>>> records = cur.fetchall()
>>>> records [0] [0]
Chuck Norris's Roundhouse Kick\xbf

,我想能够使用所有上述方法验证存储在我的Oracle数据库中的数据。我会满足于某人只是验证我在十六进制查看器中看到的是足够的测试;)

解决方案

您发布的字符文字™不是U + 0099(控制字符),而是U + 2122(TRADE MARK SIGN)。



Unicode规范定义 U + 0099如下:

  0099;< control> ;; Cc; 0; BN ;;;; N ;;;; 

所以,它甚至没有名字,我没有走开规范找出这个字符是什么。



解码U + 0099在Windows中会导致一个商标字形。



UTF-8中TRADE MARK SIGN(U + 2122)的正确字节序列为 E2 84 A2


How can I check that the trademark(™) character is set correctly in my Oracle database?

I expect it to be stored using UTF-8 encoding.

I have a value stored in a Salesforce.com field that looks like this from the GUI (notice the trademark character):

Chuck Norris's Roundhouse Kick™

I'm using Informatica to replicate it to an Oracle database. My database is set to use the AL32UTF8 encoding.

How it shows up in SQL Developer

When I query my table using SQL Developer, the trademark symbol shows up as a rectangle (black border, white fill).

How it shows up in HTML

When I export it from SQL Developer using the UTF-8 encoding into an HTML document, and open it in Chrome, the trademark symbol does not appear at all. When I open it in IE, the it appears as a rectangle again. In Firefox, it's a rectangle with 00 in the top half and 99 in the bottom half. All three browsers interpret the HTML doc using UTF-8.

How it shows up in text editors

Opening the same HTML doc in Notepad and Notepad++, the trademark symbol shows up as a rectangle. If I use the Hex Viewer plugin for Notepad++ I see the byte encoding is C2 99. That seems to be the correct encoding for the trademark symbol in UTF-8.

When I open document in MS Write, the trademark character looks like this: ™.

When I get the value programmatically

Using Python, when I get the value from the database, the trademark character is replaced with '\xbf' -- the inverted question mark, but that character is not even properly encoded as far as I can tell because it's missing at least one leading byte (depending on the specific encoding)

>>> import cx_Oracle
>>> con = cx_Oracle.connect('username', 'password', 'db')
>>> cur = con.cursor()
>>> cur.execute('select * from trademark')
<__builtin__.OracleCursor on <cx_Oracle.Connection to username@db>>
>>> records = cur.fetchall()
>>> records[0][0]
"Chuck Norris's Roundhouse Kick\xbf"

Ideally, I'd like to be able to validate the data stored in my Oracle database using all of the above methods. I'd settle for someone just validating that what I saw in the Hex Viewer was enough of a "test" ;)

解决方案

The character literal ™ you posted is not U+0099 (a control character), but U+2122 (TRADE MARK SIGN).

The Unicode spec defines U+0099 as follows:

0099;<control>;Cc;0;BN;;;;;N;;;;;

So, it doesn't even have a name and I haven't gone digging round the spec to find out what this character is for.

Decoding U+0099 in Windows does result in a trademark grapheme. I guess this is a bug.

The correct byte sequence for the TRADE MARK SIGN (U+2122) in UTF-8 is E2 84 A2.

这篇关于如何检查我的Oracle数据库中是否正确设置了商标(™)字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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