Search code examples
web-servicesunicodebugzilla

How to post a bug with Unicode text via Bugzilla REST API


I've got a problem when posting a bug with Unicode text.

My code in .NET looks like.

HttpWebRequest request = BugzillaService.MakeRequest(url, "POST");
request.ContentType = "application/json;charset=utf-8";

byte[] bytes = Encoding.UTF8.GetBytes(data);
request.ContentLength = bytes.Length;

using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(bytes, 0, bytes.Length);
}

The code works well with ASCII text.

Unicode has been turn on with Bugzilla website, I could post a bug with Unicode text via website. But failed with Bugzilla REST service.

Do I miss something must be configured in Bugzilla website or REST service to support Unicode text?

Thanks in advance.


Solution

  • Do I miss something must be configured in Bugzilla website or REST service to support Unicode text?

    Have you installed this patch?

    Also, if you are using non-ASCII characters at all, you need to patch the BZ::Client module, which has an encoding bug. The patch for that is also in the patches directory.