Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
/ pyxb Public archive
forked from pabigot/pyxb

Commit

Permalink
examples/unicode_jp: document unidecode as a potential solution
Browse files Browse the repository at this point in the history
unidecode() provides a solution for ASCII representation of unicode
data.  In lieu of complicating the standard MakeIdentifier, document the
alternative solution in the JP example and the routine that allows
override of MakeIdentifier.

Closes pabigot#67
  • Loading branch information
pabigot committed May 13, 2017
1 parent 4d313ae commit 73ff233
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/unicode_jp/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ the bindings.
Many thanks to Hiroaki Itoh for providing the schemas, example document, and
romanization code.

If you are interested in other languages, consider replacing the
ConvertJPIdentifier() function in the modified pyxbgen script with one
that uses unidecode: https://pypi.python.org/pypi/Unidecode

See this comment for further details:
https://sourceforge.net/p/pyxb/discussion/956708/thread/5246b205/#1c7f

Note: Because the package depends on OpenGIS, and OpenGIS bindings are no
longer provided in the PyXB distribution, you should generate these bindings
first. If they are missing, the test script will emit a warning and PyXB
Expand Down
5 changes: 5 additions & 0 deletions pyxb/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def _SetXMLIdentifierToPython (xml_identifier_to_python):
perform that translation before the invalid characters are
stripped.
For example, see `unidecode
<https://pypi.python.org/pypi/Unidecode>`_ and `this forum posting
<https://sourceforge.net/p/pyxb/discussion/956708/thread/5246b205/#1c7f>`_.
It is not the responsibility of this callable to do anything other
than replace whatever characters it wishes to. All
transformations performed by L{MakeIdentifier} will still be
Expand All @@ -143,6 +147,7 @@ def _SetXMLIdentifierToPython (xml_identifier_to_python):
default implementation, which is L{_DefaultXMLIdentifierToPython}.
@rtype: C{unicode}
"""
global _XMLIdentifierToPython
if xml_identifier_to_python is None:
Expand Down

0 comments on commit 73ff233

Please sign in to comment.