OS X 文件名中的元音变音 (perl)
我在 OS X 上的文件名中遇到一些元音变音(ü 字符)的问题。我正在从 perl 脚本创建目录。从概念上讲,我正在做的是:
$NAME = "abcüabc";
$PATH = "/Applications/MyProgram/".$NAME."/";
system('ditto', '--rsrc', $FROMPATH, $PATH . $FILENAME);
这将创建名为 "/Applications/MyProgram/abs%9Fabc/"
的文件夹。
有人知道如何修复此问题以创建具有正确字符的目录吗?
I'm having some troubles with umlauts (ü character) in filenames on OS X. I'm creating the directory from a perl script. Conceptually what I'm doing is:
$NAME = "abcüabc";
$PATH = "/Applications/MyProgram/".$NAME."/";
system('ditto', '--rsrc', $FROMPATH, $PATH . $FILENAME);
This creates the folder with the name "/Applications/MyProgram/abs%9Fabc/"
.
Anyone know how I can fix this to create the directory with the correct characters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你必须说:
在你的 Perl 源代码中,如果你希望这些字符串被解释为字符而不是二进制。
看?如果你这样做的话,效果就很好。
编辑:您正在使用MacRoman!
无论如何,文件系统中不能有字符 U+00FC,因为它会分解为
"u"
后跟"\N{COMBINING DIAERESIS}"
。您是否真的在 Perl 源代码中输入了 MacRoman 字符?但是你做了那吗?请转换为Unicode!! Perl 不知道您的源代码是旧版 MacRoman 中的! U+009F 是一个控制代码,意思是“\N{应用程序命令}”。在这里,观看:
您可以从这里获取uniquote程序。它会向您显示文件中的实际内容。您还可以获得macroman脚本。
您似乎以某种方式在 Perl 代码中输入了丑陋的旧 MacRoman。请转换为Unicode!
You have to say:
in your Perl source if you expect those strings to be interpreted as characters instead of binary.
See? It works just fine if you do that do it.
EDIT: You’re using MacRoman!
And you cannot have a character U+00FC in the filesystem anyway, because it decomposes to a
"u"
followed by"\N{COMBINING DIAERESIS}"
. Did you actually enter MacRoman characters in your Perl source code? However did you do THAT? Please convert to Unicode!! Perl has no idea that your source code is in legacy MacRoman! U+009F is a control code meaning "\N{APPLICATION PROGRAM COMMAND}".Here, watch:
You can grab the uniquote program from here. It will show you what is really in the file. You can also get the macroman script.
You seem to have somehow entered ugly old MacRoman in your Perl code. Please please convert to Unicode!