pyopenapi / pyswagger

An OpenAPI (fka Swagger) client & converter in python, which is type-safe, dynamic, spec-compliant.
MIT License
385 stars 89 forks source link

encoding problem regarding to SwaggerRequest, SwaggerResponse #76

Open mission-liao opened 8 years ago

mission-liao commented 8 years ago

Usually, "utf-8" works for most cases. However, it's possible that servers responding something else. Now pyswagger expects everything is utf-8, and would fail when it's not.

In short, we need to take care of this case:

text/html; charset=UTF-16

One thing we can do is always decode what we go in byte-stream by the encoding method indicated by "charset", and default value is "utf-8".