Web shows me MÃ © xico instead of México Charset UTF-8 in API REST

Hi there.
When I use the REST API and created a group whose name contains accented letters (á, é, í, ó, ú).
The result I get is something like this MÃ © xico, instead of México.
To pass data group use a json. I do not know if I have you set the charset = “UTF8” and how?.

I use Bonita 6.2

if I can give an example.

Thanks in advance.

Hello,

Please find below a python example tested successfully in 6.2.6.

#!/usr/bin/env python #============================================================================== import argparse import httplib2 import json import urllib

#==============================================================================
def portal_login(url,username,password,disable_cert_validation):
http = httplib2.Http(disable_ssl_certificate_validation=disable_cert_validation)
API=“/loginservice”
URL=url+API
body={‘username’: username, ‘password’: password, ‘redirect’: ‘false’}
headers={“Content-type”:“application/x-www-form-urlencoded”}
response, content = http.request(URL,‘POST’,headers=headers,body=urllib.urlencode(body))
if response.status!=200:
raise Exception("HTTP STATUS: "+str(response.status))
return response[‘set-cookie’]

#==============================================================================
def create_group(url,cookie,name,disable_cert_validation):
http = httplib2.Http(disable_ssl_certificate_validation=disable_cert_validation)
API=“/API/identity/group/”
URL=url+API
headers={“Content-type”:“application/json”,‘Cookie’: cookie}
data={“icon”:“”,“name”:name,“displayName”:“”,“parent_group_id”:“”,“description”:“”}
data = json.dumps(data)
response, content = http.request(URL, ‘POST’,headers=headers, body=data)
if response.status!=200:
raise Exception("HTTP STATUS: “+str(response.status)+” "+content)
else:
data = json.loads(content)
return data[‘id’]

#==============================================================================
def main():
parser = argparse.ArgumentParser(description=‘Create a Bonita group’,
add_help=False)
# required arguments
required = parser.add_argument_group(‘required arguments’)
required.add_argument(“–login”,
required=True,
help=“Account used to authenticate you on Bonita”,
metavar=“install”)
required.add_argument(“–password”,
required=True,
help=“Password used with your account”,
metavar=“install”)
required.add_argument(“–url”,
required=True,
help=“Bonita BPM url”,
metavar=“http://example.com:8080/bonita”)
required.add_argument(“–name”,
required=True,
help=“Group name”,
metavar=“México”)
# optional arguments
optional = parser.add_argument_group(‘optional arguments’)
optional.add_argument(‘-h’, ‘–help’,
action=‘help’,
help=“Show this help message and exit”)
optional.add_argument(“–disable_ssl_certificate_validation”,
help=“Used this only for tests with a self-signed certificate”,
action=“store_true”)

args = parser.parse_args()

cookie=portal_login(args.url,args.login,args.password,args.disable_ssl_certificate_validation)
gid=create_group(args.url,cookie,args.name,args.disable_ssl_certificate_validation)

#==============================================================================
if name == “main”:
main()

./create_bonita_group.py --login install --password install --url http://127.0.0.1:8080/bonita --name México

More details regarding json.dumps are available here https://docs.python.org/2/library/json.html

Hello, there might be some issues with encoding, yes. It is better to use standard characters for variables, groups, tasks, etc.

Can you tell the precise version of Bonita, OS, database and java ?

Bonita 6.2
OS: Windows 8
database: Oracle.
C#

If you try to create a group directly into the portal and it’s ok with accented letters (á, é, í, ó, ú) then you can take a look to http://stackoverflow.com/questions/9145667/how-to-post-json-to-the-server
I don’t know C# but according to that post it seems that you can use something like :

byte postBytes = Encoding.UTF8.GetBytes(json);