On Wednesday, March 19, 2014 10:46:53 AM UTC-7, [email protected] wrote:
>
> Main.asc:
>
> = Title
> // icons located in project's ./images/icons sub-directory
> :icons:
> :doctype: book
>
> == Chapter I
>
> NOTE: this is a note.
>
> Attempts to generate the various back-end artifacts:
>
> Produces main.HTML with icons (correctly)
> $ asciidoc main.asc
>
> Produces main.PDF with icons (correctly)
> $ a2x -v -d book -a docinfo -f pdf --stylesheet=style.css --icons --fop 
> main.asc
>
> Produces main.EPUB without icons (correctly)
> $ a2x -v -d book -a docinfo -f epub --stylesheet=style.css main.asc
>
> Generates an error when attempting to create main.EPUB with icons
> $ a2x -v -d book -a docinfo -f epub --stylesheet=style.css --icons main.asc
>
> Output/Error:
>
> a2x: args: ['-v', '-d', 'book', '-a', 'docinfo', '-f', 'epub', 
> '--stylesheet=style.css', '--icons', 'main.asc']
> a2x: resource files: []
> a2x: resource directories: 
> ['/usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/images', 
> '/usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/stylesheets']
> a2x: executing: "/usr/local/Cellar/asciidoc/8.6.9/bin/asciidoc.py" 
> --backend docbook -a "a2x-format=epub"  --doctype book --attribute 
> "docinfo" --verbose  --out-file 
> "/Users/xxx/Projects/asciidoc/test/main.xml" 
> "/Users/xxx/Projects/asciidoc/test/main.asc"
>
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/asciidoc.conf
> asciidoc: reading: /Users/craibuc/Projects/asciidoc/test/main.asc
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/docbook45.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/filters/code/code-filter.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/filters/graphviz/graphviz-filter.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/filters/latex/latex-filter.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/filters/music/music-filter.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/filters/source/source-highlight-filter.conf
> asciidoc: reading: 
> /usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/lang-en.conf
> asciidoc: writing: /Users/xxx/Projects/asciidoc/test/main.xml
> asciidoc: main.asc: line 13: evaluating: 
> {include:/Users/xxx/Projects/asciidoc/test/main-docinfo.xml}
>
> a2x: executing: "xmllint" --nonet --noout --valid 
> "/Users/xxx/Projects/asciidoc/test/main.xml"
> a2x: deleting /Users/xxx/Projects/asciidoc/test/main.epub.d
> a2x: creating /Users/xxx/Projects/asciidoc/test/main.epub.d
> a2x: chdir /Users/xxx/Projects/asciidoc/test/main.epub.d
> a2x: executing: "xsltproc"  --stringparam callout.graphics 1 --stringparam 
> navig.graphics 1 --stringparam admon.textlabel 0 --stringparam 
> admon.graphics 1 --stringparam html.stylesheet "style.css" --stringparam 
> toc.section.depth 1 --stringparam chunk.section.depth 0  
> "/usr/local/Cellar/asciidoc/8.6.9/etc/asciidoc/docbook-xsl/epub.xsl" 
> "/Users/xxx/Projects/asciidoc/test/main.xml"
>
> Writing OEBPS/pr01.html for preface
> Writing OEBPS/ch01.html for chapter(_chapter_i)
> Writing OEBPS/ch02.html for chapter(_chapter_ii)
> Writing OEBPS/index.html for book
> Writing OEBPS/toc.ncx
> Writing OEBPS/content.opf
> Writing OEBPS/cover.html for mediaobject
> Writing META-INF/container.xml
>
> a2x: chdir /Users/xxx/Projects/asciidoc/test
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/content.opf
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/ch01.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/ch02.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/cover.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/index.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/pr01.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/ch01.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/ch02.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/cover.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/index.html
> a2x: finding resources in: /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/pr01.html
>
> a2x: creating /Users/xxx/Projects/asciidoc/test/main.epub.d/OEBPS/images
> a2x: copying "/Users/xxx/Projects/asciidoc/test/images/cover-page.jpg" to 
> "/Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/images/cover-page.jpg"
> a2x: creating /Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/images/icons
> a2x: copying "/Users/xxx/Projects/asciidoc/test/images/icons/note.png" to 
> "/Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/images/icons/note.png"
> a2x: copying "/Users/xxx/Projects/asciidoc/test/images/icons/tip.png" to 
> "/Users/xxx/Projects/asciidoc/test/main.epub.d/OEBPS/images/icons/tip.png"
> a2x: copying "/Users/xxx/Projects/asciidoc/test/style.css" to "/Users/xxx
> /Projects/asciidoc/test/main.epub.d/OEBPS/style.css"
> a2x: adding to manifest: images/icons/note.png
> a2x: adding to manifest: images/icons/tip.png
>
> Traceback (most recent call last):
>   File "/usr/local/bin/a2x", line 960, in <module>
>     a2x.execute()
>   File "/usr/local/bin/a2x", line 378, in execute
>     self.__getattribute__('to_'+self.format)()
>   File "/usr/local/bin/a2x", line 782, in to_epub
>     self.update_epub_manifest(opf_file)
>   File "/usr/local/bin/a2x", line 760, in update_epub_manifest
>     write_file(opf_file, opf.toxml())
>   File "/usr/local/bin/a2x", line 150, in write_file
>     f.write(data)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in 
> position 292: ordinal not in range(128)
>
> What is happening?
>
> Thanks.
>


I had this same issue today.  Worked without --icons and failed with it.

After some investigation it appears to be an issue in a2x where it isn't 
encoding the manifest file as UTF-8.  In my case I had a copyright symbol 
introduced through the docinfo.xml file.  My fix was to alter the a2x file 
itself as detailed in this bug fix page for fedora:

https://lists.fedoraproject.org/pipermail/scm-commits/Week-of-Mon-20131202/1153359.html

I checked the mercurial repository and it doesn't have this change.

The essence of the change is this:

import codecs
...
def write_file(filename, data, mode='w', encoding='utf-8'):
    f = codecs.open(filename, mode, encoding)
...

The above worked for me.  I think you should try and report back whether it 
worked for you.  Perhaps then if it works we can suggest that it be fixed?

John.

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.

Reply via email to