Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing annotation with non english caracters is not working #448

Closed
etiennepouliot opened this issue Sep 12, 2016 · 0 comments
Closed

Editing annotation with non english caracters is not working #448

etiennepouliot opened this issue Sep 12, 2016 · 0 comments

Comments

@etiennepouliot
Copy link

etiennepouliot commented Sep 12, 2016

To reproduce :

vmconf = vim.vm.ConfigSpec() 
vmconf.annotation = u'ééééééé'
vm.ReconfigVM_Task(vmconf)

Result in :

File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 580, in
self.f(_(self.args + (obj,) + args), *_kwargs)
File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 386, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 1321, in InvokeMethod
req = self.SerializeRequest(mo, info, args)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 938, in SerializeRequest
result.append(_SerializeToUnicode(arg, param, self.version, nsMap))
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 180, in _SerializeToUnicode
SoapSerializer(writer, version, nsMap).Serialize(val, info)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 255, in Serialize
self._Serialize(val, info, self.defaultNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 340, in _Serialize
self._SerializeDataObject(val, info, attr, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 483, in _SerializeDataObject
self._Serialize(getattr(val, prop.name), prop, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 387, in _Serialize
self._Serialize(it, itemInfo, defNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 340, in _Serialize
self._SerializeDataObject(val, info, attr, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 483, in _SerializeDataObject
self._Serialize(getattr(val, prop.name), prop, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 340, in _Serialize
self._SerializeDataObject(val, info, attr, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 483, in _SerializeDataObject
self._Serialize(getattr(val, prop.name), prop, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 340, in _Serialize
self._SerializeDataObject(val, info, attr, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 483, in _SerializeDataObject
self._Serialize(getattr(val, prop.name), prop, currDefNS)
File "/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 451, in _Serialize
self.writer.write('<{0}{1}>{2}</{0}>'.format(info.name, attr, result))

I think to solve is simply to make sure that's writtern in unicode (the u before the quote) :
/usr/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py
self.writer.write(u'<{0}{1}>{2}</{0}>'.format(info.name, attr, result))

Tester with version 6.0.0.2016.6.

tianhao64 pushed a commit to tianhao64/pyvmomi that referenced this issue Mar 21, 2017
…serializer to support serializing unicode chars

We use string formatter to contruct serialization result.
The template used is str(byte) in python2 even though when the val is
unicode.
This is fine when val only contains ASCII chars since python can encode
them to str implicitly using ASCII encoding. But when the val is
non-ASCII unicodes,
the conversion fails. Fix it by using a unicode template to avoid the
conversion.
tianhao64 pushed a commit to tianhao64/pyvmomi that referenced this issue Mar 21, 2017
…serializer to support serializing unicode chars

We use string formatter to contruct serialization result.
The template used is str(byte) in python2 even though when the val is
unicode.
This is fine when val only contains ASCII chars since python can encode
them to str implicitly using ASCII encoding. But when the val is
non-ASCII unicodes,
the conversion fails. Fix it by using a unicode template to avoid the
conversion.
tianhao64 added a commit that referenced this issue Mar 21, 2017
Fixes #519, #448, #420, #421 Fix SoapAdapter serializer to support se…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants