rabbit-shockers:99
From: miyamuko@m...
Date: Wed, 8 Feb 2006 18:55:51 +0900 (JST)
Subject: [rabbit-shockers:99] Re: リリース予告
みやむこです。 > > > Windows では --output-html で生成されるファイル名に日本語を含む場合、 > > > 文字化けしたファイルが作られてしまいます。 > > > > > > % rabbit -s --output-html sample\can_rabbit.rd > > > % ls > > > できるRabbit1.png > > > 縺ァ縺阪kRabbit1.html <- !!! > > > Windows では GLib.filename_from_utf8 (というか g_filename_from_utf8) が > > > (G_FILENAME_ENCODING などに関わらず) 常にファイル名に utf8 を使用するため > > > 化けるようです (たぶん)。 > > > > 確認なんですが,Windowsでは以下のようになっているんですよね? > > > > * ファイル名がUTF-8になっていないと化ける. > > * GLib.filename_from_utf8はShift_JISな文字列を返す. あ、逆です。 * ファイル名は Shift_JIS になっていないと化ける。 * GLib.filename_from_utf8は UTF8 な文字列を返す。 * Gdk::PixBuf#save は内部で UTF8->SJIS な変換をしている。 (だから SJIS を与えるとエラーになる) * GLib.charset は CP932 を返す * GLib.locale_from_utf8 は Shift_JIS な文字列を返す かなり quick hack ぎみですが、以下で直りました。 Index: template.erb =================================================================== --- template.erb (revision 561) +++ template.erb (working copy) @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="<%= encoding %>"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <style type="text/css"> div.navi Index: generator.rb =================================================================== --- generator.rb (revision 561) +++ generator.rb (working copy) @@ -31,6 +31,9 @@ end def save(file_name_format, slide_number, image_type) + if Utils.windows? + file_name_format = GLib.locale_from_utf8(file_name_format) + end file_name = slide_file_name(file_name_format, slide_number) File.open(file_name, "w") do |f| f.print(to_html(file_name_format, slide_number, image_type)) @@ -120,9 +123,23 @@ end def slide_title - Utils.unescape_title(@canvas.slide_title) + title = Utils.unescape_title(@canvas.slide_title) + if Utils.windows? + GLib.locale_from_utf8(title) + else + title + end end + def encoding + if Utils.windows? + "Shift_JIS" + else + "UTF-8" + end + end + alias charset encoding + def make_rss(base_uri) base_uri = base_uri.chomp('/') + '/' RSS::Maker.make('1.0') do |maker| -- ML: rabbit-shockers@m... 使い方: http://QuickML.com/
91 2006-02-08 10:42 [kou@c... ] リリース予告 96 2006-02-08 17:20 ┣[miyamuko@m... ] 97 2006-02-08 17:51 ┃┗[kou@c... ] @ 98 2006-02-08 18:21 ┃ ┗[kou@c... ] -> 99 2006-02-08 18:55 ┃ ┗[miyamuko@m... ] 101 2006-02-08 21:43 ┃ ┗[kou@c... ] 104 2006-02-08 23:43 ┃ ┗[miyamuko@m... ] 105 2006-02-08 23:53 ┃ ┗[kou@c... ] 107 2006-02-09 02:00 ┃ ┗[miyamuko@m... ] 100 2006-02-08 19:29 ┗[miyamuko@m... ] 102 2006-02-08 21:45 ┗[kou@c... ]