dkd / php-cmis-client

This is a PHP CMIS Client implementation based on OpenCMIS. It has been retired and put in to archive mode.
Apache License 2.0
54 stars 34 forks source link

cmis:name encoding character error #77

Closed wallon-ines closed 2 days ago

wallon-ines commented 4 years ago

I have a problem with charset when upload a document.

eg: if my document name is RéàDME.md in Alfresco I see Réàdme.md

Capture d’écran_2020-08-26_17-51-47

ps: I rework CreateDocument.php for this test

    $cid = $session->createObjectId($document->getId());
    echo "Document has been created. Document Id: " . $document->getId() . " Name:" . $session->getObject($cid)->getName() ."\n";
wallon-ines commented 4 years ago

If I add _charset_=UTF-8 in form post in my curl request, it's work

How to integrate _charset_=UTF-8 in this library ?

eg:

curl -X POST    http://locfalhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Shared    -u 'admin:admin'    -H 'content-type: multipart/form-data; charset=utf-8; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'    -F cmisaction=createDocument    -F 'propertyId[0]=cmis:objectTypeId'    -F 'propertyValue[0]=cmis:document'    -F 'propertyId[1]=cmis:name'    -F 'propertyValue[1]=jàvà_error_in_STUDIO_3456.log'    -F file=@jàvà_error_in_STUDIO_3456.log -F _charset_=UTF-8 | jq
sascha-egerer commented 4 years ago

@wallon-ines You should be able to define that in the guzzle connection / httpInvoker.

https://github.com/dkd/php-cmis-client/blob/master/examples/CreateDocument.php#L9-L24

lraghib commented 3 years ago

@sascha-egerer even if we set the charset like that:

 $httpInvoker = new Client(
            [
                'debug' => true,
                'verify' => false,
                'auth'   => [
                    "xxxx",
                    "xxxx",
                ],
                'headers' => [
                    'charset' => 'utf-8'
                ]

            ]
        );

it doesn't work because this line AbstractBrowserBindingService.php#L444 changes the header values