获得" sed的错误 - 非法的字节序列" (在bash) [英] Getting "sed error - illegal byte sequence" (in bash)

查看:825
本文介绍了获得" sed的错误 - 非法的字节序列" (在bash)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

做一些流编辑改变讨厌的Parallels图标。它的不发达和嵌入到应用程序本身,而不是作为一个图像文件。所以,我已经位于该有一些很好的反馈此sed命令:

Doing some stream editing to change the nasty Parallels icon. It's poorly developed and embedded into the app itself rather than being an image file. So I've located this sed command that has some good feedback:

sudo sed -i.bak s/Parallels_Desktop_Overlay_128/Parallels_Desktop_Overlay_000/g /Applications/Parallels\ Desktop.app/Contents/MacOS/prl_client_app

它返回 sed的:RE错误:非法字节序列

谁能解释这是什么意思?哪一部分的命令是什么问题?

Can anyone explain what this means? What part of the command is the problem?

推荐答案

尝试设置了 LANG 环境变量( LANG = C的sed ... )或使用这里提到的二进制SED工具之一:二进制sed替换

Try setting the LANG environment variable (LANG=C sed ...) or use one of the binary sed tools mentioned here: binary sed replacement

为什么出错?

没有 LANG = C SED假定文件是连接在任何编码在 LANG 指定codeD和文件(即二进制)可能包含不在 LANG 有效字符字节的编码(这样你可以得到非法字节序列')

Without LANG=C sed assumes that files are encoded in whatever encoding is specified in LANG and the file (being binary) may contain bytes which are not valid characters in LANG's encoding (thus you could get 'illegal byte sequence').

为什么 LANG = C 工作?

Why does LANG=C work?

ç恰好把所有的ASCII字符为自己和非ASCII字符的文字。

C just happens to treat all ASCII characters as themselves and non-ASCII characters as literals.

这篇关于获得" sed的错误 - 非法的字节序列" (在bash)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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