[alexandria/f17] More UTF-8 fix on ruby 1.9, when exporting library to CSV and bibtex
Mamoru Tasaka
mtasaka at fedoraproject.org
Wed May 30 01:26:30 UTC 2012
commit 0472321c53bb0d69e8d0bc3d1408d577be425097
Author: TASAKA Mamoru <mtasaka at localhost.localdomain>
Date: Wed May 30 10:26:26 2012 +0900
More UTF-8 fix on ruby 1.9, when exporting library to CSV and bibtex
- Remove garbage character with icon view on multibyte locate
...ia-0.6.8-export-to-CSV-bintex-with-ruby19.patch | 34 ++++++++++++++++++++
alexandria-0.6.8-iconview-multibyte.patch | 12 +++++++
alexandria.spec | 15 +++++++-
clog | 4 +-
4 files changed, 61 insertions(+), 4 deletions(-)
---
diff --git a/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch b/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch
new file mode 100644
index 0000000..ee53db3
--- /dev/null
+++ b/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch
@@ -0,0 +1,34 @@
+--- alexandria-0.6.8/lib/alexandria/export_library.rb.ruby19_csv 2012-05-30 10:04:18.167329943 +0900
++++ alexandria-0.6.8/lib/alexandria/export_library.rb 2012-05-30 10:07:52.230277906 +0900
+@@ -241,7 +241,14 @@
+ File.open(filename, 'w') do |io|
+ io.puts "Title" + ';' + "Authors" + ';' + "Publisher" + ';' + "Edition" + ';' + "ISBN" + ';' + "Year Published" + ';' + "Rating" + "(0 to #{UI::MainApp::MAX_RATING_STARS.to_s})" + ';' + "Notes" + ';' + "Want?" + ';' + "Read?" + ';' + "Own?" + ';' + "Tags"
+ each do |book|
+- io.puts book.title + ';' + book.authors.join(', ') + ';' + (book.publisher or "") + ';' + (book.edition or "") + ';' + (book.isbn or "") + ';' + (book.publishing_year.to_s or "") + ';' + (book.rating.to_s or "0") + ';' + (book.notes or "") + ';' + ( book.want ? "1" : "0") + ';' + ( book.redd ? "1" : "0") + ';' + ( book.own ? "1" : "0") + ';' + (book.tags ? book.tags.join(', ') : "")
++ io.puts book.title.force_encoding('UTF-8') + ';' +
++ book.authors.join(', ').force_encoding('UTF-8') + ';' +
++ (book.publisher or "").force_encoding('UTF-8') + ';' +
++ (book.edition or "").force_encoding('UTF-8') + ';' + (book.isbn or "") + ';' +
++ (book.publishing_year.to_s or "") + ';' + (book.rating.to_s or "0") + ';' +
++ (book.notes or "") + ';' + ( book.want ? "1" : "0") + ';' +
++ ( book.redd ? "1" : "0") + ';' + ( book.own ? "1" : "0") +
++ ';' + (book.tags ? book.tags.join(', ') : "")
+ end
+ end
+ end
+@@ -499,12 +506,12 @@
+ if book.authors != []
+ bibtex << book.authors[0]
+ book.authors[1..-1].each do |author|
+- bibtex << " and #{latex_escape(author)}"
++ bibtex << " and #{latex_escape(author.force_encoding('UTF-8'))}"
+ end
+ end
+ bibtex << "\",\n"
+- bibtex << "title = \"#{latex_escape(book.title)}\",\n"
+- bibtex << "publisher = \"#{latex_escape(book.publisher)}\",\n"
++ bibtex << "title = \"#{latex_escape(book.title.force_encoding('UTF-8'))}\",\n"
++ bibtex << "publisher = \"#{latex_escape(book.publisher.force_encoding('UTF-8'))}\",\n"
+ if book.notes and not book.notes.empty?
+ bibtex << "OPTnote = \"#{latex_escape(book.notes)}\",\n"
+ end
diff --git a/alexandria-0.6.8-iconview-multibyte.patch b/alexandria-0.6.8-iconview-multibyte.patch
new file mode 100644
index 0000000..30bfef0
--- /dev/null
+++ b/alexandria-0.6.8-iconview-multibyte.patch
@@ -0,0 +1,12 @@
+--- alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb.icon_multibyte 2012-05-30 10:04:18.132330198 +0900
++++ alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb 2012-05-29 18:29:54.430690741 +0900
+@@ -824,6 +824,9 @@
+ iter[Columns::IDENT] = book.ident.to_s
+ iter[Columns::TITLE] = book.title
+ title = book.title.sub(REDUCE_TITLE_REGEX, '\1...')
++ # More nice method is needed here...
++ title = title.encode("UTF-16", "UTF-8", :invalid => :replace, :undef => :replace, :replace => ".")
++ title = title.encode("UTF-8")
+ iter[Columns::TITLE_REDUCED] = title
+ # Don't know why, however force_encoding seems needed here to
+ # prevent crash...
diff --git a/alexandria.spec b/alexandria.spec
index c80d247..7fd4250 100644
--- a/alexandria.spec
+++ b/alexandria.spec
@@ -9,7 +9,7 @@
%undefine minorver
%undefine ifpre
-%define fedorarel 7
+%define fedorarel 8
%define rel %{?ifpre:0.}%{fedorarel}%{?minorver:.%minorver}
@@ -65,6 +65,11 @@ Patch18: alexandria-0.6.8-utf8-convert.patch
# More UTF-8 fix on ruby 1.9, when exporting library to HTML
# (bug 819188)
Patch19: alexandria-0.6.8-export-to-HTML-with-ruby19.patch
+# More UTF-8 fix on ruby 1.9, when exporting library to csv
+# or bibtex
+Patch20: alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch
+# Remove garbage character with icon view on multibyte locate
+Patch21: alexandria-0.6.8-iconview-multibyte.patch
BuildArch: noarch
BuildRequires: ruby(abi) >= %{rubyabi}
@@ -133,7 +138,9 @@ Alexandria is a GNOME application to help you manage your book collection.
%patch16 -p1 -b .evalfix
%patch17 -p1 -b .z3950_next
%patch18 -p1 -b .ruby19_utf8
-%patch19 -p1 -b .export
+%patch19 -p1 -b .export_html
+%patch20 -p1 -b .export_csv
+%patch21 -p1 -b .icon_kanji
# Embed Fedora EVR
%{__sed} -i.evr \
@@ -228,6 +235,10 @@ exit 0
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%changelog
+* Wed May 30 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.8.6-8
+- More UTF-8 fix on ruby 1.9, when exporting library to CSV and bibtex
+- Remove garbage character with icon view on multibyte locate
+
* Sun May 6 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.8.6-7
- More UTF-8 fix on ruby 1.9, when exporting library to HTML
(bug 819188)
diff --git a/clog b/clog
index 52eeb70..c0a561d 100644
--- a/clog
+++ b/clog
@@ -1,3 +1,3 @@
-More UTF-8 fix on ruby 1.9, when exporting library to HTML
+More UTF-8 fix on ruby 1.9, when exporting library to CSV and bibtex
- (bug 819188)
+- Remove garbage character with icon view on multibyte locate
More information about the scm-commits
mailing list