是否可以在编码为带有 BOM 的 UTF-8 的文件上运行 SQLPLUS 脚本

2021-12-24 00:00:00 utf-8 oracle byte-order-mark plsql

我正在尝试运行从大量来源自动生成的脚本集合.不幸的是,其中一些已生成为带有 BOM 的 UTF-8.我有一个自动删除 BOM 的系统,但它的过程有点混乱.

I'm trying to run a collection of scripts which have been auto-generated from a large number of sources. Unfortunately some of these have been generated as UTF-8 with BOM. I have in place a system for automatically removing the BOM, but its a bit of a messy process.

未能移除 BOM 会产生错误:

Failing to remove the BOM generates the error:

SP2-0042: unknown command "" - rest of line ignored.

是否可以在具有 BOM 的脚本文件上运行 SQLPLUS?

Is it possible to run SQLPLUS on a script file which has a BOM?

推荐答案

用这样的脚本运行 SQLPLUS 是可能的,但 SQLPLUS 会在第一行提示错误,因为 物料清单.
可能您想问是否可以避免此错误 - 不可能,AFAIK.Erwin 也这么认为.

It is possible to run SQLPLUS with such script, but SQLPLUS will indicate an error on the first line because of BOM.
Probably you wanted to ask if you can avoid this error - it is not possible, AFAIK. Erwin thinks so too.

您可以通过生成第一行为空的文件来解决丢失任何信息的问题.那么你可以忽略这个错误.

You can workaround losing any information by generating those files with an empty first line. Then you can just ignore this error.

相关文章