Revert "Fix unicode comment handling for Python 2 (#740)"
This reverts commit 313069bf934c400e8d9e6fe7ba4b9ef8cd3c548d.
Caused problems on some platforms, not worth the risk to fix for old Python.
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 582fbc3..e40f18b 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -154,7 +154,6 @@
try:
strtypes = (unicode, str)
openmode_unicode = 'rU'
- str = unicode
except NameError:
strtypes = (str, )
openmode_unicode = 'r'
@@ -2265,10 +2264,7 @@
os.makedirs(dirname)
with open(path, 'w') as f:
- try:
- f.write(data)
- except UnicodeEncodeError:
- f.write(data.encode('utf-8'))
+ f.write(data)
def main_plugin():
'''Main function when invoked as a protoc plugin.'''