From bfa74bf1775056233ffd06a0ec858f20d61c1df3 Mon Sep 17 00:00:00 2001 From: divide Date: Mon, 25 Feb 2008 04:47:10 +0000 Subject: [PATCH] Polish letters get transliterated to avoid unknown chars on device. git-svn-id: file:///home/divide/svn/trunk/walkgirl/trunk@444 92f4db9c-a619-0410-8c93-89f5936be7a8 --- walkgirl/id3.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/walkgirl/id3.rb b/walkgirl/id3.rb index 3e1315b..db9f579 100644 --- a/walkgirl/id3.rb +++ b/walkgirl/id3.rb @@ -82,6 +82,9 @@ require "md5" require 'hexdump' # load hexdump method to extend class String require 'invert_hash' # new invert method for old Hash require 'iconv' +require 'jcode' + +$KCODE = "UTF8" class Hash # overwrite Hash.invert method alias old_invert invert @@ -1105,8 +1108,14 @@ module ID3 end def recode(encoding) begin + if self["encoding"] == 3 # utf8 + self["text"].tr! "ąćęśżłź", "aceszlz" + end self["text"] = Iconv.conv(ENCODINGS[encoding], ENCODINGS[self["encoding"]], self["text"]) self["encoding"] = encoding + if self["encoding"] == 3 # utf8 + self["text"].tr! "ąćęśżłź", "aceszlz" + end rescue end self -- 2.11.4.GIT