AnsweredAssumed Answered

Problem when posting UTF8 using CMIS

Question asked by fgozman on Mar 26, 2010
Hi all

I try to create a folder with a name containing UTF8 chars using CMIS but is not working properly.
The folder name is "folder ățîșă" where 'ă', 'ț', 'î', 'ș', 'ă' are unicode chars. When the code is executed Alfresco make a folder "folder ățîșă" instead. I think the problem is about encoding.
I have tried also with other unicode chars and didn't worked.
I'm using the following code:

…..
String xmlData=
                "<?xml version='1.0' encoding='utf-8'?>" +
                "<entry xmlns='http://www.w3.org/2005/Atom'
                           xmlns:cmisra='http://docs.oasis-open.org/ns/cmis/restatom/200908/'
                           xmlns:cmis='http://docs.oasis-open.org/ns/cmis/core/200908/'>" +
                    "<title><![CDATA[folder ățîșă]]></title>" +                  
                    "<author><![CDATA[Michele]]></author>"+
                    "<link rel='alternate' href=''/>"+
                    "<summary><![CDATA[folder ățîșă]]></summary>"+
                    "<cmisra:object>" +
                        "<cmis:properties>" +                          
                            "<cmis:propertyId propertyDefinitionId='cmis:objectTypeId'>"+
                                "<cmis:value>cmis:folder</cmis:value>"+
                             "</cmis:propertyId>" +
                        "</cmis:properties>" +
                    "</cmisra:object>" +
                "</entry>";
            HttpPost httpost =
                new HttpPost(createURI(cmisServicePath+"/s/workspace:SpacesStore/p//children"));
            StringEntity ent= new StringEntity(xmlData,"utf-8");
            ent.setContentType("application/atom+xml; type=entry; charset=utf-8;");
            httpost.setEntity(ent);
            HttpResponse response = httpclient.execute(httpost);
            showResponse(response);  
            httpost.abort();
….

If somebody had the same problem or know how to fix let me know.

Best regards
Florian

Outcomes