应用程序路径中的rake和utf-8 char

时间:2012-02-05 08:09:06

标签: ruby utf-8 rake

我使用我用rake编译的应用程序。问题是如果我在包含非US-ASCII char的路径中设置我的应用程序目录,则编译失败。

例如:

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

1 个答案:

答案 0 :(得分:1)

问题不在于文件的编码,而是路径中的非ascii符号('Téléchargements')。

显然,异常发生在第785行的mkmf的#checking_for和rake中。作为Rakefile的作者,除了报告上游和/或找到一种方法来避免使用该方法之外,我无能为力。

快速修复是使用没有非ascii符号的路径,抱歉。