简体   繁体   English

在US-ASCII问题中使用ruby 1.9.3的Rails 3.2无效字节序列

[英]Rails 3.2 with ruby 1.9.3 invalid byte sequence in US-ASCII issue

Is there somebody to help me with this issue that's driving me nuts for days... 有没有人可以帮助我解决这个困扰我好几天的问题...

In fact. 事实上。 I've upgraded my rails config to 3.2 and ruby to 1.9.3 and since then my jquery file is not working anymore giving me an error that is: 我已经将rails config升级到3.2,将ruby升级到1.9.3,从那时起我的jquery文件不再工作了,给我一个错误是:

invalid byte sequence in US-ASCII US-ASCII中的无效字节序列

After a lot of tries I've found that this line is causing the problem: 经过大量尝试,我发现此行引起了问题:

rates.push(new Array('<%= tva_rate.id %>', '<%= tva_rate.tva_taux %>', '<%= tva_rate.tva_code %>'));

and I think that is the < and > characters... Problem is that I need these to make the code working... I've tried to add: 我认为这是<和>字符...问题是我需要这些字符才能使代码正常工作...我尝试添加:

# encoding: utf-8

but it does work... 但这确实有效...

Thanks for your help. 谢谢你的帮助。

after one week of investigation, I finally solve this problem. 经过一周的调查,我终于解决了这个问题。 This could be interesting for you to know that the problem was not directly the javascript code BUT the data it refers to... 您可能会很感兴趣,因为您知道问题不在于javascript代码,而是它所引用的数据...

In fact, in the corresponding table I have a record with an "é" character causing the problem... It means that when you update from Ruby 1.8... to Ruby 1.9... you have to clear your data from invalid characters before updgrading. 实际上,在相应的表中,我有一条记录带有“é”字符,这导致了问题……这意味着,当您从Ruby 1.8更新到Ruby 1.9时,您必须清除无效字符中的数据升级之前。

Then if you re-create the entry in the database after the update all working like a charm. 然后,如果您在更新后在数据库中重新创建条目,则所有工作都像超级按钮一样。

Hope it could help. 希望它能有所帮助。

Dan

您可以添加到您的.bashrc

export RUBYOPT=-Ku

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM