summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a40003)
raw | patch | inline | side by side (parent: 2a40003)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 26 May 2010 21:13:12 +0000 (23:13 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 19 Jun 2010 15:03:13 +0000 (17:03 +0200) |
The lyrics are recieved in Latin1, but UTF-8 is needed.
lyrics/20-lyricwiki.rb | patch | blob | history |
diff --git a/lyrics/20-lyricwiki.rb b/lyrics/20-lyricwiki.rb
index db7b970307dd03d944eb76e971cedaf8698c72ce..3873e7a8120cec248817391c8cf8d8f0c8189623 100755 (executable)
--- a/lyrics/20-lyricwiki.rb
+++ b/lyrics/20-lyricwiki.rb
require 'uri'
require 'net/http'
require 'cgi'
+require 'iconv'
url = "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong" + \
"&artist=#{URI.escape(ARGV[0])}&song=#{URI.escape(ARGV[1])}"
exit(1)
end
-puts CGI::unescapeHTML($1.gsub(/<br \/>/, "\n"))
+# lyrics come in Latin1, but we need UTF-8
+lyrics_latin1 = CGI::unescapeHTML($1.gsub(/<br \/>/, "\n"))
+puts Iconv.conv('UTF-8//TRANSLIT//IGNORE', 'Latin1', lyrics_latin1)