java - 从文本文件读取时显示符号 '  '

标签 java byte-order-mark

使用与此处相同的项目和文本文件:Java.NullPointerException null (again)该程序正在输出数据,但带有 。把你放在照片中:

This program is a telephone directory, ignoring the first "code" block, look at the second "code" block on that link, that is the text file with the entries. The program outputs them as it should but it is giving  at the beginning of the entries read from the text file ONLY.

关于如何删除它的任何帮助?我正在使用带有文件阅读器的缓冲阅读器。

  • 文本文件编码:UTF-8
  • 使用 Java 7
  • Windows 7

最佳答案

读入的文本文件是否使用带 BOM 的 UTF-8?它看起来像 BOM 标志:“” http://en.wikipedia.org/wiki/Byte_order_mark

你在运行 Windows 吗? Notepad++ 应该可以转换。如果使用 linux 或 VI(M) 你可以使用 ":set nobomb"

关于java - 从文本文件读取时显示符号 '  ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14710366/

相关文章:

java - 在 Pi 3 B+ 上使用 Processing Pi 的 GLSL 着色器

java - 无法将 XML 字符串正确转换为 JAXB 对象

.net - XML - 根级别的数据无效

r - 为什么 R 将 UTF-8 header 读取为文本?

java - Apache FileUtils 是否有办法在附加到 UTF-16 文件时考虑 BOM?

java - 将远程 Mysql 连接到 Netbeans

java - JDialog 未在父 JFrame 上居中

Java:命名空间中类的前向声明

python - 如何从 rsyslog 消息中删除 BOM(字节顺序标记)

php - 删除 URL 中的 UTF-8 DOM - JS 和 PHP