Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Character encoding with HTTPBuilder

Hi there. I'm using JMWE add-on to perform a HTTP POST request on an issue as a post function. Here's my code:

import groovyx.net.http.HTTPBuilder;
import static groovyx.net.http.ContentType.*;
import groovyx.net.http.ContentType;
import static groovyx.net.http.Method.*;

def http = new HTTPBuilder('myhost.com')
http.request( POST ) {
uri.path = '/'
requestContentType = ContentType.JSON
body = [title: issue.get("summary"), desc: issue.get("description")]
log.info(body.title)
response.success = { resp ->
log.info( "POST response status: "+resp.statusLine+"}")
}
}

This is what request looks like from my web service side:image.pngIn Jira and Groovy test console characters look fine.

How do I fix this?

1 answer

0 votes

Hi Gleb,

I don't believe the encoding is wrong - it's just that your console on the web service side cannot print Unicode characters. JSON supports Unicode without any problem, so your request body is correct.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Desk

The Complete Guide to Atlassian for ITSM

Hi Atlassian Community! This is Teresa from the Atlassian team. My colleague Paul Buffington @Buff and I are excited to share a brand new ITSM resource we’ve created – "The Complete Guide to At...

2,151 views 15 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you