oracle 倒置问号问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2925131/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Upside down question mark issue
提问by mita
We have a very strange problem in out application, all of a sudden we started noticing upside down question marks being saved along with other text typed in to the fields on the screen. These upside down question marks were not originally entered by the users and it is unclear where they come from. We are using Oracle 10g with java. And this is happening, even when no data is copied from Microsoft Word
我们在应用程序中遇到了一个非常奇怪的问题,突然间我们开始注意到倒置的问号与其他输入到屏幕字段中的文本一起保存。这些倒置的问号最初并不是由用户输入的,目前还不清楚它们来自哪里。我们正在使用带有 Java 的 Oracle 10g。这正在发生,即使没有从 Microsoft Word 复制数据
回答by Fantabel
Could the user have pasted a line from MS Word in the jsp field?
用户是否可以在 jsp 字段中粘贴来自 MS Word 的一行?
回答by Gary Myers
The upside-down question mark is often used when the character stored cannot be rendered by the client. So often the data in the database is fine, it is a restriction in the client.
当存储的字符不能被客户端渲染时,经常使用倒置的问号。所以往往数据库里的数据是好的,是客户端的限制。
My first step would be to use the DUMP function to identify the bytes. As a first step, I'd strip out common 'known valid' characters (alphanumerics and space)
我的第一步是使用 DUMP 函数来识别字节。作为第一步,我会去掉常见的“已知有效”字符(字母数字和空格)
select DUMP(translate(upper(col),'~ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,','~'),16) dmp,
translate(upper(col),'~ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,','~') val
from ...
where translate(upper(col),'~ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,','~') is not null;
Then I concentrator on what is left. Normally there's a bunch of rare, but acceptable, punctuation (point, comma, hyphen, apostrophe etc). I exclude them one by one.
然后我专注于剩下的东西。通常有一堆罕见但可以接受的标点符号(点、逗号、连字符、撇号等)。我一一排除。
Anything I can't exclude I'll research (ie google those bytes, which is why I use the '16' option with DUMP, to get them in hex). It is probably some accented character, or a quote like “test” rather than the bland "test".
任何我不能排除的东西我都会研究(即谷歌那些字节,这就是为什么我使用 '16' 选项和 DUMP 来获取它们的十六进制)。它可能是一些带重音的字符,或者像“test”这样的引用,而不是平淡的“test”。
回答by Laplace
回答by madhumita
Thanks all for your response. Some how there is this particular text field in the jsp for which this is happening.And it is saving this weird character in that column in the table when there is no data for this field.Data is also not rendering properly in the database.And the weird part is, this is not even happening with every record as I could not replicate.
谢谢大家的回复。一些如何在发生这种情况的 jsp 中存在这个特定的文本字段。当该字段没有数据时,它会将这个奇怪的字符保存在表的该列中。数据在数据库中也没有正确呈现。并且奇怪的是,这甚至不是每条记录都会发生,因为我无法复制。
回答by mita
I found a solution to this problem, though still not aware of the cause .
我找到了解决此问题的方法,但仍然不知道原因。
****The code which was causing the error:****
****导致错误的代码:****
if(certHolderLoanNumber == null){
如果(certHolderLoanNumber == null){
certHolderLoanNumber = "";//we don't want to display "null"
certHolderLoanNumber = "";//我们不想显示“null”
}
}
%>
%>
Loan Number: " />
借书号:" />
The code which solved the problem:
解决问题的代码:
certHolderLoanNumber = certificateHolder.getCertHolderLoanNumber();
certHolderLoanNumber = certificateHolder.getCertHolderLoanNumber();
Loan Number: " />
借书号:" />
Previously when the certHolderLoanNumber field was explicitly set to "" , the value retrieved as per seen by running the debugger was " ".And when this value was further saved into the database the upside down questions mark was appearing in the xml clob.The GenUtils.nonnull also returns empty String, but this time no upside down question mark appeared. Strange!!
以前,当 certHolderLoanNumber 字段显式设置为 "" 时,通过运行调试器检索到的值为“ ”。当该值进一步保存到数据库中时,倒置的问号出现在 xml clob 中。 GenUtils.nonnull 也返回空字符串,但这次没有出现倒置的问号。奇怪的!!