Skip to content

Commit 779c415

Browse files
authored
Merge pull request #19 from EndPointCorp/fix/handle_unicode
Fix UTF-8 serialization
2 parents 795dfc8 + fa33317 commit 779c415

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gennodejs/generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def get_dynamic_field_length_line(field, query):
597597
if not is_string(f.base_type):
598598
raise Exception('Unexpected field {} with type {} has unknown length'.format(f.name, f.base_type))
599599
# it's a string array!
600-
line_to_write = 'length += 4 + val.length;'
600+
line_to_write = 'length += 4 + _getByteLength(val);'
601601
else:
602602
(package, msg_type) = f.base_type.split('/')
603603
samePackage = spec.package == package
@@ -618,7 +618,7 @@ def get_dynamic_field_length_line(field, query):
618618
raise Exception('Unexpected field {} with type {} has unknown length'.format(f.name, f.base_type))
619619
# it's a string array!
620620
len_constant_length_fields += 4
621-
line_to_write = 'length += object.{}.length;'.format(f.name)
621+
line_to_write = 'length += _getByteLength(object.{});'.format(f.name)
622622
else:
623623
(package, msg_type) = f.base_type.split('/')
624624
samePackage = spec.package == package

0 commit comments

Comments
 (0)