ref |> Modified The generated code uses utf-8 encoding by default.
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index fb75cf7..3b79948 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -2499,7 +2499,7 @@
             if dirname and not os.path.exists(dirname):
                 os.makedirs(dirname)
 
-            with open(path, 'w') as f:
+            with open(path, 'w', encoding='utf-8') as f:
                 f.write(data)
 
 def main_plugin():