| Summary: | OVIRT-SDK: sdk fails to serialize non-ascii | ||
|---|---|---|---|
| Product: | [Retired] oVirt | Reporter: | Jaroslav Henner <jhenner> |
| Component: | ovirt-engine-sdk | Assignee: | Michael Pasternak <mpastern> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | unspecified | CC: | acathrow, bazulay, dyasny, iheim, mgoldboi, ykaul |
| Target Milestone: | --- | ||
| Target Release: | 3.1 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | infra | ||
| Fixed In Version: | 3.1.0.5 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-08-09 08:05:33 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
make sure you have # -*- coding: utf-8 -*- when verifying this bug. closing ON_QA bugs as oVirt 3.1 was released: http://www.ovirt.org/get-ovirt/ |
Description of problem: non-ascii chars is a problem for ovirt-engine-sdk. Version-Release number of selected component (if applicable): ovirt-engine-sdk-1.6.4-1.fc16.noarch How reproducible: always Steps to Reproduce: 1. # -*- encoding: utf-8 -*- FUNNY_CHARS = "!@#$%^&*{}<>? <!-- ]]> <?PCDATA[[ <?CDATA[[ \" \"\'\" °ěščřžýáíéůü Việt Nam עִבְרִית" def test_funny_chars_in_PUT_xml_error(self): cl = APICKO.clusters.get(name="Default") cl.description = FUNNY_CHARS cl.update() Actual results: ====================================================================== ERROR: test_funny_chars_in_PUT_xml_error (general_tests.MockedServerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "general_tests.py", line 239, in test_funny_chars_in_PUT_xml_error cl.update() File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 123, in update body=ParseHelper.toXml(self.superclass)) File "/usr/lib/python2.7/site-packages/ovirtsdk/utils/parsehelper.py", line 35, in toXml entity.export(output, 0, name_=ParseHelper.getXmlTypeInstance(type_name)) File "/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py", line 5260, in export self.exportChildren(outfile, level + 1, namespace_, name_) File "/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py", line 5268, in exportChildren super(Cluster, self).exportChildren(outfile, level, namespace_, name_, True) File "/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py", line 4210, in exportChildren outfile.write('<%sdescription>%s</%sdescription>\n' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 72: ordinal not in range(128) if I change the funny chars to unicode string like this: FUNNY_CHARS = u"!@#$%^&*{}<>? <!-- ]]> <?PCDATA[[ <?CDATA[[ \" \"\'\" °ěščřžýáíéůü Việt Nam עִבְרִית" I'll get: Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib64/python2.7/unittest/__main__.py", line 12, in <module> main(module=None) File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__ self.parseArgs(argv) File "/usr/lib64/python2.7/unittest/main.py", line 149, in parseArgs self.createTests() File "/usr/lib64/python2.7/unittest/main.py", line 158, in createTests self.module) File "/usr/lib64/python2.7/unittest/loader.py", line 128, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib64/python2.7/unittest/loader.py", line 91, in loadTestsFromName module = __import__('.'.join(parts_copy)) File "general_tests.py", line 161, in <module> """.format(FUNNY_CHARS)), UnicodeEncodeError: 'ascii' codec can't encode characters in position 50-61: ordinal not in range(128) Expected results: No problem to use unicode chars, because it seems to be accepted by other means - webadmin as well as WPF gui. Additional info: