Skip to content

Instantly share code, notes, and snippets.

@wlt
Created April 19, 2013 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlt/5418589 to your computer and use it in GitHub Desktop.
Save wlt/5418589 to your computer and use it in GitHub Desktop.
Vimperatorの'encoding'オプションが機能してなかったので修正

症状

  1. 補完の問題
:setlocal encoding=

と入力しても補完が表示されない。(「Generating results...」のまま) エラーメッセージ「TypeError: options.getPref(...) is null」 2. 設定の問題

:setlocal encoding=UTF-8

と有効であるはずの値を与えても「Invalid argument: UTF-8」と言うエラーが出て、エンコーディング方式を変更できない。

環境

Vimperator : 3.8pre (changeset: 4738:468e6460934b) Firefox : Mozilla/5.0 (X11; FreeBSD amd64; rv:20.0) Gecko/20100101 Firefox/20.0

背景

'encoding'オプションの補完関数はエンコーディング方式の一覧を得るためにプリファレンス"intl.charsetmenu.browser.*"を参照する。

原因

'encoding'オプションの補完関数が参照しているプリファレンス"intl.charsetmenu.browser.unicode"が削除された為。 また、このプリファレンスは"UTF-8"を含んでいる。 Bug 805374 - Remove UTF-16 family from Character Encoding menu. r=smontagu

修正方法

削除されたプリファレンスの代わりに" intl.charsetmenu.browser.static"を使う。これはユーザ設定可能なものであるが、"UTF-8"を含む事が必要とされている。 mozilla-central mozilla/toolkit/locales/en-US/chrome/global/intl.properties About:config entries - MozillaZine Knowledge Base

# HG changeset patch
# User wlt_lain <wltlain@gmail.com>
# Date 1366349348 25200
# Node ID c86d02b8f78b542a920c8b9fded2e0c349a32080
# Parent 468e6460934b937df5731cd840a500dea6f5d23a
fix: 'encoding' option
diff -r 468e6460934b -r c86d02b8f78b common/content/io.js
--- a/common/content/io.js Thu Apr 18 00:47:10 2013 +0900
+++ b/common/content/io.js Thu Apr 18 22:29:08 2013 -0700
@@ -988,7 +988,7 @@
context.anchored = false;
context.generate = function () {
let names = util.Array(
- "more1 more2 more3 more4 more5 unicode".split(" ").map(function (key)
+ "more1 more2 more3 more4 more5 static".split(" ").map(function (key)
options.getPref("intl.charsetmenu.browser." + key).split(', '))
).flatten().uniq();
let bundle = document.getElementById("liberator-charset-bundle");