cancel
Showing results for 
Search instead for 
Did you mean: 

problem setting encoding on ScriptContent

rhofkens
Champ in-the-making
Champ in-the-making
Hello,

[using Alf 210E]
I've built a webscript to upload files.  Everything works as expected, I just can't set the right content encoding.

The relevant lines of javascript:


  // create document in folder for uploaded file
  upload = uploadFolder.createFile(filename) ;
  upload.properties.content.write(content);
  //set correct mimetype and encoding
  upload.properties.content.mimetype = uploadMimeType;
  upload.properties.content.encoding = "UTF-8";
  upload.properties.title = title;
  upload.properties.description = description;
  upload.save();

Alfresco throws an error on the line where i set the encoding to UTF-8:


Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/klm/klmupload.post.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/klm/klmupload.post.js': Java class "org.alfresco.repo.jscript.ScriptNode$ScriptContentData" has no public instance field or method named "encoding". (AlfrescoScript#50)

According to the Javascript documentation in the code, this property should be there.  I've checked the source code (org.alfresco.repo.jscript.ScriptNode.java) and haven't found a setter/getter for the encoding on ScriptContentData.  Is this a bug (didn't find it on JIRA) or am I missing something?

Cheers,
Roeland.
2 REPLIES 2

rhofkens
Champ in-the-making
Champ in-the-making
** bump **

Anyone?

thx,
Roeland.

davidc
Star Contributor
Star Contributor
I've just checked the source too, and it seems the encoding setter is not there in 2.1.

It's definitely in HEAD.

I'll update the WIKI as it's incorrect.