Hi all,
It's really hard to find informations on the options to give to the
'Text (encoded)' filter. I finally found out the information needed to
import the file with the proper character set.
1/ I created a snippet to explain the solution
2/ Could it be possible to complete the wiki with the list of the
possible character sets, and the filter options details. ?
Thanks,
Cedric
<?xml version="1.0"?>
<!--
$RCSfile: $
last change: $Revision: $ $Author: $ $Date: $
(c)2003 by the copyright holders listed with the author-tags.
If no explicit copyright holder is mentioned with a certain author,
the author him-/herself is the copyright holder. All rights reserved.
Public Documentation License Notice:
The contents of this Documentation are subject to the
Public Documentation License Version 1.0 (the "License");
you may only use this Documentation if you comply with
the terms of this License. A copy of the License is
available at http://www.openoffice.org/licenses/PDL.html
The Original Documentation can be found in the CVS archives
of openoffice.org at the place specified by RCSfile: in this header.
The Initial Writer(s) of the Original Documentation are listed
with the author-tags below.
The Contributor(s) are listed with the author-tags below
without the marker for being an initial author.
All Rights Reserved.
-->
<snippet language="OOBasic" application="Writer">
<keywords>
<keyword>Text (encoded)</keyword>
<keyword>FilterOptions</keyword>
</keywords>
<authors>
<author id="cedricbosdo" initial="true" email="[EMAIL PROTECTED]" copyright="2007 (c) StarXpert">Cedric Bosdonnat</author>
</authors>
<question heading="Importing a plain text encoded with a given character set">How to import a plain text file encoded with a given character set
<p>Simply suppose we need to import MyTest.txt which is encoded in IBM850, also knwon as cp850.</p>
</question>
<answer>
<p>For this, we need to use the 'Text (encoded)' filter and configure it properly as shown by the code snippet.</p>
<p>The possible character set codes are all listed on this page: http://equalitylearning.org/~robertz/oo_encoding_indexes.html</p>
<listing> Dim oMediaDescriptor(1) as new [EMAIL PROTECTED] com.sun.star.beans.PropertyValue}
sFileUrl = convertToUrl( "H:\My Test.txt" )
oMediaDescriptor(0).name = "FilterName"
oMediaDescriptor(0).value = "Text (encoded)"
oMediaDescriptor(1).name = "FilterOptions"
oMediaDescriptor(1).value = "IBM_850"
oDoc = StarDesktop.loadComponentFromURL(sFileURL, "_blank", 0, oMediaDescriptor)</listing>
</answer>
<versions>
<version number="2.0.x" status="tested"/>
</versions>
<operating-systems>
<operating-system name="All"/>
</operating-systems>
<changelog>
<change author-id="cedricbosdo" date="2007-01-03">Initial version</change>
</changelog>
</snippet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]