Hello!
I try to add comment via rest, but can add it only if body is latin. If body is not latin I have 400 and errorMessages":["Invalid UTF-8 start byte 0xfb\n at [Source: org.apache.catalina.connector.CoyoteInputStream@355b26b7; line: 1, column: 42]"]}
I try to set encoding=utf-8 but have no luck
Here is my request
curl -i -u "user:password" -H "Content-type: application/json; charset=utf-8" -H "Accept: application/json" -d"{\"body\":\"абвгд\"}" -X POST https://jiratest/rest/api/latest/issue/issueKey/comment
Try charset=ISO-8859-1
first.
If that doesn't work, you may have to pre-convert all the special characters in the body text into their UTF-8 codes before submitting it, such as:
{ body : "\u1072\u1073\u1074\u1075\u1076" }
@David Bakkers thanks for help. I found out that if you run curl in cmd, then the -d argument parameter has the same encoding as the Windows console - CP866. Even if you set -H "Content-type: application/json; charset=utf-8". So I've execute curl command from linux and everything is fine.
But if you need run it in windows workaroud is saving json in a file in utf-8 encoding and passing the request body like this:
curl -X POST -i -H "Content-type: application/json; charset=utf-8" -d @C:\request_body.json
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear you worked it out, and that there is difference to how curl does encoding in Windows vs Linux.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.