Problem with UTF-8 strings/content sending by POST
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2008 01:17 PM
Alfresco version: (Community Network): Current version 2.9.0 (B 683) schema 116
I've a big problem - just below - while trying to store content after editing on custom editor, and sending by HTTP POST into a custom webscript. Looks like the webservice always recoding UTF-8 characters to UTF-8.
As a difference between community edition 2.1 and 2.9B; this 'bug?' presents in 2.1 in GET and POST, but only in POST on version 2.9B…
Is there a workaround to fix this issue, or i need to wait for next Alfresco release?
Shell script to test answering on service:
Answer by GET:
Answer by POST:
I've a big problem - just below - while trying to store content after editing on custom editor, and sending by HTTP POST into a custom webscript. Looks like the webservice always recoding UTF-8 characters to UTF-8.
As a difference between community edition 2.1 and 2.9B; this 'bug?' presents in 2.1 in GET and POST, but only in POST on version 2.9B…
Is there a workaround to fix this issue, or i need to wait for next Alfresco release?
Shell script to test answering on service:
#!/bin/shPROTOCOL="http"USERPASS="admin:admin"HOST="127.0.0.1:8080"# gethtdump "${PROTOCOL}://${USERPASS}@${HOST}/alfresco/service/eu/tenderworks/formtest?formdata=ékezetesókősségík"# posthtdump -post="formdata=ékezetesókősségík" "${PROTOCOL}://${USERPASS}@${HOST}/alfresco/service/eu/tenderworks/formtest"
Answer by GET:
<pre>ékezetesókősségík</pre>
Answer by POST:
<pre>ékezetesókÅ‘sségÃk</pre>
Labels:
- Labels:
-
Archive
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2008 02:20 AM
Fixed by a base64 encoder/decoder (encode content before POST, and decode in webscript): http://www.webtoolkit.info/javascript-base64.html
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2008 05:07 AM
Same effect with 3.0 Labs too…

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2008 09:21 AM
Hello LouiSe,
I have exactlly the same problem and as you I'm using base64 encoding. But when script decodes message and saves it to the file message becomes corrupted like "ékezetesókÅ‘sségÃk". So could you pls write a sample web script, where content is decoded from base64 string?
Thank you.
I have exactlly the same problem and as you I'm using base64 encoding. But when script decodes message and saves it to the file message becomes corrupted like "ékezetesókÅ‘sségÃk". So could you pls write a sample web script, where content is decoded from base64 string?
Thank you.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2008 09:44 AM
Example part of my webscript:
for each (field in formdata.fields) { if(field.name == 'parent') { var parent = field.value; } else if (field.name == 'updatenoderef') { var updatenoderef = field.value; } else if (field.name == 'file' && field.isFile) { var filename = field.filename; var content = field.content; }}var contentData = Base64.decode(content);var newContent = parentNode.childByNamePath(name);if (newContent == null && parentNode.hasPermission("CreateChildren")) { newContent = parentNode.createFile(name);} newContent.properties.content.write(contentData);newContent.properties.content.encoding = "UTF-8";if (args.title != undefined) { newContent.properties.title = Utf8.decode(args.title);} if (args.description != undefined) { newContent.properties.description = Utf8.decode(args.description);} newContent.save();
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2008 11:08 AM
Thanks for the sample script, but it seems that write method and encoding property is not supported in version 2.2, so instead of
Moreover if I just skip the encoding/decoding procedure and write content directly, like newContent.properties.content.content = "ékezetesókősségík", behaviour will be the same.
newContent.properties.content.write(contentData);newContent.properties.content.encoding = "UTF-8";
I just wrote newContent.properties.content.content = contentData
, but it didn't help :xMoreover if I just skip the encoding/decoding procedure and write content directly, like newContent.properties.content.content = "ékezetesókősségík", behaviour will be the same.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2008 02:29 AM
Just follow this thread: http://forums.alfresco.com/en/viewtopic.php?f=14&t=10286
db.url=jdbc:mysql://localhost/alfresco?useUnicode=true&characterEncoding=utf-8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2008 04:28 AM
It doesn't help either.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2008 04:31 AM
Sorry, i haven't other idea

