openshift / openshift-restclient-java

Other
78 stars 112 forks source link

Update resource cannot support Chinese characters #456

Closed a85302543 closed 4 years ago

a85302543 commented 4 years ago

When I use Openshift Java Client to create or update a resource , I found a problem :when configuring env with Chinese character like that:

"env": [
  {
    "name": "key-2",
    "value": "中文字符"
  }, 
  {
   "name": "key-1",
    "value": "value-1"
  }
]

and the return values is wrong and like:

"env": [
  {
    "name": "key-2",
    "value": �����������������
  }, 
  {
   "name": "key-1",
    "value": "value-1"
  }
]

The problem seems like that when posting the request, the Chinese character can not be recognized . A temporary solution is changing the code. from

 return RequestBody.create(json, MediaType.parse("application/json"));

to

 return RequestBody.create(json, MediaType.parse("application/json;charset=utf-8"));

is there other way to avoid this or this problem can be sovled :) thanks

Version: 9.0.0.Final
Class:DefalutClient.java
line: 339
adietish commented 4 years ago

Hi

I think that there's no harm in what you suggest and should be included if it fixes your issue. Dare to suggest a PR, please? @jeffmaury Thoughts?

adietish commented 4 years ago

@a85302543 let me please point out that this client is in maintenance mode, we'll only fix existing/new bugs as far as they are essential to the proper functioning of this library. If you're looking for a more feature complete & active library, we suggest that you use https://github.com/fabric8io/kubernetes-client/ instead.

a85302543 commented 4 years ago

@adietish Hi thanks for your reply! I'll give it a try

adietish commented 4 years ago

Fix at #459 merged. Closing.