在firefox扩展中使用非英语文本(插件)

时间:2010-01-10 11:39:58

标签: javascript firefox-addon

这是我在我的插件中的javascript文件中的代码:

 function ShotText() {
      var inputString = "שלום"; //Hebrew letters
      alert(inputString);             
}

当我使用插件运行此功能时,我得到了这个:
alt text http://img693.imageshack.us/img693/8782/shalom2.jpg

但是如果我在没有addon(常规javascript函数)的情况下运行相同的代码,我会得到这个:
alt text http://img693.imageshack.us/img693/5236/shalom1.jpg

问题出在哪里?

也许我需要在扩展程序中的某处设置编码?

1 个答案:

答案 0 :(得分:2)

https://developer.mozilla.org/En/International_characters_in_XUL_JavaScript详细解释了这种行为。请注意,无论如何这都是错误的,因为用户可见的字符串应该在扩展名的locale中,以便扩展名可以转换为其他语言。