unicode perforce 服务器中的 BOM 问题 [英] BOM issue in unicode perforce server

查看:61
本文介绍了unicode perforce 服务器中的 BOM 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重现问题的步骤:

  1. 向我的 P4 服务器添加一个文件,该文件被检测为 'utf8' 文件类型.

  1. Add a file to my P4 server, the file is detected as 'utf8' file type.

我添加的文件是utf8编码,没有BOM.

The file I added is utf8 encoding without BOM.

vim 中的 nobomb 显示

nobomb show in vim

p4 客户端将其检测为 'utf8'

p4 client detect it as 'utf8'

如果我在其他设备上做同样的步骤,文件类型被检测为'unicode';

  1. 从本地删除文件,然后从服务器同步.出现问题:文件变为带有 BOM 的 utf8.

同步文件,文件变成带有BOM的utf

sync the file, the file become utf with BOM

如您所知,html 文件中的 BOM 会导致很多问题......有没有人可以帮助我解决这个问题?

As you know, BOM in html file can cause lots of issue....Is there anyone who can help me to solve this issue?

环境:

  1. 客户端版本:Rev.Perforce Visual Client/MACOSX107X86_64/2015.2/1312139

p4 服务器处于unicode"模式.

p4 server is in "unicode" mode.

推荐答案

'utf8' 类型的文件总是与 BOM 同步 - 'utf8' 类型就是这样设计的(请参阅 relnotes,#998379).如果您不想要 BOM,则必须将其更改为文本"或Unicode".

Files of type 'utf8' always sync with the BOM - 'utf8' type is designed that way (see relnotes, #998379). If you don't want the BOM you're going to have to change it to 'text' or 'unicode'.

您所描述的是 15.2 中的一个已知错误 (job083614):如果 P4CHARSET=utf8 并且服务器是 unicode 并且文件的字节数 >x80 并且是有效的 utf8"然后文件被检测为utf8,应该是unicode.此修复程序有望(无承诺)在 16.2 中.

What you describe is a known bug(job083614) in your 15.2: "if P4CHARSET=utf8 and server is unicode and file has bytes >x80 and is valid utf8" then file is detected as utf8, should be unicode. This fix should hopefully (no promises) be in 16.2.

较早的 p4 客户端 <= 15.1 应将其检测为unicode".

Earlier p4 clients <= 15.1 should detect it as 'unicode'.

如果你不想输入'utf8'而是'unicode':

If you don't want type 'utf8' but rather 'unicode':

  • 使用p4 add -t unicode "添加您的文件
  • 在提交前更改文件类型.
  • 使用 typemap 将所有具有特定扩展名的文件添加为'unicode'.
  • 使用客户端(p4v、p4 命令行)<= 2015.1 来添加文件.后续同步/提交可以是更高版本.
  • add your file with "p4 add -t unicode <file>"
  • change the file's type before submitting.
  • use typemap to make all files with certain extension add as 'unicode'.
  • use a client (p4v, p4 command line) <= 2015.1 to add the files. Subsequent syncs/submits can be later versions.

你也可以有一个触发器来防止utf8文件类型被提交(change-submit)

You can also have a trigger to prevent utf8 file types from being submitted(change-submit)

这篇关于unicode perforce 服务器中的 BOM 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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