<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic API JS Problem managing content with accents and other symb. in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/api-js-problem-managing-content-with-accents-and-other-symb/m-p/235130#M188260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually I’m having some problems with the JS API (in conjuntion with accented vowels and other special chars) when I’m reading the content of a .txt file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code opens a file that is placed in an Alfresco Space, like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;var file = companyhome.childByNamePath(“NAME OF THE TXT FILE”);&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I obtain the content as follow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;var content = file.content;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And finally I assign this content as the value of a property of other content that I’ve in the repository, more or less like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;var doc = companyhome.childByNamePath(“NAME OF THE DOC FILE”);&lt;BR /&gt;doc.properties[“NAME PROPERTY”] =content;&lt;BR /&gt;doc.save();&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that the chars as ‘á’, ‘à’, ‘é’, ’è’,… Are loaded as ‘?’ chars (the non special chars are displayed correctly). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On the other hand if you edit directly the property (from the properties sheet), you can put these special chars with no problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thx.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Xavi&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Mar 2010 14:22:38 GMT</pubDate>
    <dc:creator>madcaddie</dc:creator>
    <dc:date>2010-03-31T14:22:38Z</dc:date>
    <item>
      <title>API JS Problem managing content with accents and other symb.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/api-js-problem-managing-content-with-accents-and-other-symb/m-p/235130#M188260</link>
      <description>Hi everyone!!!Actually I’m having some problems with the JS API (in conjuntion with accented vowels and other special chars) when I’m reading the content of a .txt file. My code opens a file that is placed in an Alfresco Space, like:var file = companyhome.childByNamePath(“NAME OF THE TXT FILE”);Then</description>
      <pubDate>Wed, 31 Mar 2010 14:22:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/api-js-problem-managing-content-with-accents-and-other-symb/m-p/235130#M188260</guid>
      <dc:creator>madcaddie</dc:creator>
      <dc:date>2010-03-31T14:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: API JS Problem managing content with accents and other symb.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/api-js-problem-managing-content-with-accents-and-other-symb/m-p/235131#M188261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Finally I’ve found a solution. The problem is related with the encoding of the file: if you update a plain txt to the system via CIFS (like I was doing), it takes as default the encoding UTF-8. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then if you want to process it with symbols like accents and other special chars, the best that you can do is encode the file as “windows-1252” before processing the file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you add this modification to the previous code, it will look as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;&lt;BR /&gt;var file = companyhome.childByNamePath(“NAME OF THE TXT FILE”);&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;file.properties.content.encoding = "windows-1252";&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;var content = file.content;&lt;BR /&gt;var doc = companyhome.childByNamePath(“NAME OF THE DOC FILE”);&lt;BR /&gt;doc.properties[“NAME PROPERTY”] =content;&lt;BR /&gt;doc.save();&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See ya,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Xavi&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 17:48:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/api-js-problem-managing-content-with-accents-and-other-symb/m-p/235131#M188261</guid>
      <dc:creator>madcaddie</dc:creator>
      <dc:date>2010-04-06T17:48:52Z</dc:date>
    </item>
  </channel>
</rss>

