应用程序路径中的 rake 和 utf-8 字符
我使用一个使用 rake 编译的应用程序。问题是,如果我将应用程序目录设置在包含非 US-ASCII 字符的路径中,则编译会失败。
例如:
cd /home/user/Downloads/my_app
rake
==>它有效
cd /home/user/Téléchargements/my_app
rake
==>它不起作用
我的系统是完整的 utf-8
我怎样才能避免这种情况?
有关信息,我尝试编译的应用程序很微妙:
hg clone http://hg.subforge.org/subtle
cd subtle
rake
这里是完整的错误消息:
** Invoke default (first_time)
** Invoke config (first_time)
** Execute config
checking for stdio.h... yes
checking for stdlib.h... yes
checking for stdarg.h... yes
checking for string.h... yes
checking for unistd.h... yes
checking for signal.h... yes
checking for errno.h... yes
checking for assert.h... yes
checking for sys/time.h... yes
checking for sys/types.h... yes
checking for sys/inotify.h... yes
checking for wordexp.h... yes
rake aborted!
invalid byte sequence in US-ASCII
/usr/lib/ruby/1.9.1/mkmf.rb:785:in `[]'
/usr/lib/ruby/1.9.1/mkmf.rb:785:in `checking_for'
/home/silkmoth/Téléchargements/subtle/Rakefile:335:in `block in <top (required)>'
/usr/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/usr/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/usr/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/bin/rake:32:in `<main>'
Tasks: TOP => default => config
I use an application which I compile using rake. The problem is if I set my application directory in a path containing non US-ASCII char, the compilation fails.
For exemple:
cd /home/user/Downloads/my_app
rake
==> it works
cd /home/user/Téléchargements/my_app
rake
==> it doesn't work
My system is full utf-8
How can I avoid this?
For information the application that I try to compile is subtle :
hg clone http://hg.subforge.org/subtle
cd subtle
rake
Here the full error message:
** Invoke default (first_time)
** Invoke config (first_time)
** Execute config
checking for stdio.h... yes
checking for stdlib.h... yes
checking for stdarg.h... yes
checking for string.h... yes
checking for unistd.h... yes
checking for signal.h... yes
checking for errno.h... yes
checking for assert.h... yes
checking for sys/time.h... yes
checking for sys/types.h... yes
checking for sys/inotify.h... yes
checking for wordexp.h... yes
rake aborted!
invalid byte sequence in US-ASCII
/usr/lib/ruby/1.9.1/mkmf.rb:785:in `[]'
/usr/lib/ruby/1.9.1/mkmf.rb:785:in `checking_for'
/home/silkmoth/Téléchargements/subtle/Rakefile:335:in `block in <top (required)>'
/usr/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/usr/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/usr/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/bin/rake:32:in `<main>'
Tasks: TOP => default => config
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不在于文件的编码,而在于路径中的非 ASCII 符号(“Téléchargements”)。
显然,异常发生在 mkmf 第 785 行的 #checking_for 中,与 rake 结合使用。作为 Rakefile 的作者,除了报告上游和/或找到一种完全避免该方法的方法之外,我对此无能为力。
快速修复是使用没有非 ASCII 符号的路径,抱歉。
The problem is not the encoding of the files, but the non-ascii symbols in your path ('Téléchargements').
Apparently, the exception happens in #checking_for from mkmf on line 785 in combination with rake. As author of the Rakefile, there is nothing I can do about that, besides reporting that upstream and/or find a way to avoid the method at all.
Quick fix is use a path without non-ascii symbols, sorry.