CLOB中是否保留转义序列? [英] Are escape sequences preserved in CLOB?

查看:162
本文介绍了CLOB中是否保留转义序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Java和Oracle进行开发.

We are using Java and Oracle for development.

我在Oracle数据库中有一个表,其中有一个CLOB列.某些XYZ应用程序在此列中转储文本文件.文本文件有多行.

I have table in a oracle database which has a CLOB column in it. Some XYZ application dumps a text file in this column. The text file has multiple rows.

在通过Java应用程序读取相同的CLOB文件时,转义序列(换行符等)可能会丢失吗?

Is it possible that while reading the same CLOB file thru Java application, the escape sequences (new line chars, etc) may get lost??

原因我问这是,我们要逐行解析此文件,如果转义序列丢失了,那会很麻烦.我本来会做这个分析的,但是我正在休假,我的团队需要紧急帮助.

Reason I asked this is, we gona parse this file line by line and if the escape sequences are lost, then we would be trouble. I would have done this analysis myself, but I am on vacation and my team needs urgent help.

如果您能提供任何想法/建议,我们将不胜感激.

Would really appreciate if you could provide any thoughts/inputs.

推荐答案

您需要确保在整个过程中使用一种正确且相同的字符编码.我强烈建议您为此选择UTF-8.它涵盖了世界上已知的每个人类角色.应该指导涉及字符数据处理的每个步骤都使用完全相同的编码.

You need to ensure that you use the one correct and same character encoding throughout the whole process. I strongly recommend you to pickup UTF-8 for that. It covers every human character known at the world. Every step which involves handling of character data should be instructed to use the very same encoding.

在SQL上下文中,确保使用UTF-8字符集创建数据库和表.在JDBC上下文中,确保JDBC驱动程序正在使用UTF-8.这通常可以通过JDBC连接字符串进行配置.在Java代码上下文中,确保从流中读取/写入字符数据时正在使用UTF-8;您可以在InputStreamReaderOutputStreamWriter中将其指定为第二个构造函数参数.

In SQL context, ensure that the DB and table is created with UTF-8 charset. In JDBC context, ensure that JDBC driver is using UTF-8; this is often configureable by JDBC connection string. In Java code context, ensure that you're using UTF-8 when reading/writing character data from/to streams; you can specify it as 2nd constructor argument in InputStreamReader and OutputStreamWriter.

这篇关于CLOB中是否保留转义序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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