gpt4 book ai didi

utf-8 - 在 Windows 中将 cp1252 批量转换为 utf-8

转载 作者:行者123 更新时间:2023-12-01 01:20:20 27 4
gpt4 key购买 nike

所以,
我一直在尝试将大型 Java 源代码树从 cp1252 转换为 Windows 中的 UTF-8,使用我在网上找到的提示和 trix,特别是 here .问题是,我在 Windows 上;我不做VB; Cygwin 的 iconv 不接受 -o转变。

我第一次尝试使用的行是:

find . -type f -print -exec iconv -f cp1252 -t utf-8 {} > {}.converted \; -exec mv {}.converted {} \;

这将创建一个文件 {}.converted在工作目录和第二个 -exec由于显而易见的原因而失败。

在 iconv 表达式周围加上引号:
find . -type f -print -exec 'iconv -f cp1252 -t utf-8 {} > {}.converted' \; -exec mv {}.converted {} \;

导致以下错误:
find: `iconv -f cp1252 -t utf-8 ./java/dv/framework/activity/model/ActivitiesMediaViewImpl.java > ./java/dv/framework/activity/model/ActivitiesMediaViewImpl.java.converted': No such file or directory

尽管手动执行各个表达式效果很好。

我已经尝试过随机引用,但似乎没有任何效果,我错过了什么?为什么它不起作用..?

提前谢谢,
拉斯

最佳答案

for f in `find . -type f`; do
iconv -f cp1252 -t utf-8 $f > $f.converted
mv $f.converted $f
done

关于utf-8 - 在 Windows 中将 cp1252 批量转换为 utf-8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9687594/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com