Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

How i can specific encoding for javasphinx-apidoc output? #56

Closed
isccarrasco opened this issue Nov 1, 2016 · 4 comments
Closed

How i can specific encoding for javasphinx-apidoc output? #56

isccarrasco opened this issue Nov 1, 2016 · 4 comments

Comments

@isccarrasco
Copy link

I have a java project, where my java files use the "UTF-8" encoding, 'cause the comments on some classes are writted on spanish using accents.

When i run the command.

javasphinx-apidoc -o docs/java ~/Development/Projects/code/java -f -v

always return the follow error:

Traceback (most recent call last):
    File "/Users/user/Development/Projects/Docs/sphinx/myenv/bin/javasphinx-apidoc", line 11, in <module>sys.exit(main())
    File "/Users/user/Development/Projects/Docs/sphinx/myenv/lib/python2.7/site-packages/javasphinx/apidoc.py", line 317, in main write_documents(documents, sources, opts)
    File "/Users/user/Development/Projects/Docs/sphinx/myenv/lib/python2.7/site-packages/javasphinx/apidoc.py", line 112, in write_documents f.write(document)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 1464: ordinal not in range(128)

I wanto to specific the encoding of the files for the apidoc can write this files using utf-8.

is this possible?

i asked this question on SO in this thread

Thanks for your help.

@bramp
Copy link

bramp commented Nov 13, 2016

I've hit the same problem, but I worked around it by changing line javasphinx/apidoc.py line 112, to be f.write(document.encode('utf-8')).

@isccarrasco
Copy link
Author

Thanks @bramp ... this solution is working for me...

@bramp
Copy link

bramp commented Dec 10, 2016

This should perhaps be kept open until it is fixed properly. I don't know if my suggested fix is the right one (because I don't really know python, or the details of UTF-8 and python), but happy to send a PR with my fix.

@isccarrasco isccarrasco reopened this Dec 10, 2016
@c2nes c2nes closed this as completed in c2edf5a Dec 12, 2016
@c2nes
Copy link
Contributor

c2nes commented Dec 12, 2016

Just pushed a change to fix this. Thanks for opening up the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants