Hello R masters,

I have sent this same message to other lists and none so far could give some
light. I was trying to use odfWeave to generate a report from R and Im
getting an error that I think is related to latin characters. I looked
around and did find some stuff related to this problem about Sweave
http://labmoluscos.wordpress.com/2010/02/18/sweave-latex-character-encoding/
but
did not find a way to fix it so far for odfWeave. Perhaps some one could
give me some light on how to workaround it.

I think my problem is that I have a table with characters such as 'ç', 'ó'
and 'ã' that odfWeave is not recognizing properly. The error follows below.

Just to make it clear: Windows vista (default language - Brazilian
Portuguese), R 2.11.1, odfWeave 0.7.11, OpenOffice 3.0.1

in my odt file ...

  <<tabela2, echo = FALSE, results = xml>>=

odfTable(tabela2,useRowNames=T,name ='Tabela 2')

@

in R console ...

>library(odfWeave)
>imageDefs <- getImageDefs()
>imageDefs$type <- 'bmp'
>imageDefs$device <- 'bmp'
 >setImageDefs(imageDefs)
>options(SweaveSyntax="SweaveSyntaxNoweb")
>odfWeave('teste.odt','figura1.odt')
  Copying  teste.odt
  Setting wd to
C:\Users\PEDROE~1\AppData\Local\Temp\Rtmpfv32oJ/odfWeave0215405313
  Unzipping ODF file using unzip -o "teste.odt"
Archive:  teste.odt
 extracting: mimetype
   creating: Configurations2/statusbar/
  inflating: Configurations2/accelerator/current.xml
   creating: Configurations2/floater/
   creating: Configurations2/popupmenu/
   creating: Configurations2/progressbar/
   creating: Configurations2/menubar/
   creating: Configurations2/toolbar/
   creating: Configurations2/images/Bitmaps/
   inflating: content.xml
  inflating: styles.xml
 extracting: meta.xml
  inflating: Thumbnails/thumbnail.png
  inflating: settings.xml
  inflating: META-INF/manifest.xml

  Removing  teste.odt
  Creating a Pictures directory

  Pre-processing the contents
  Sweaving  content.Rnw

  Writing to file content_1.xml
  Processing code chunks ...
    1 : term verbatim(label=fluxograma)
Loading required package: shape
Loading required package: shape
    2 : term xml(label=tabela2)

  'content_1.xml' has been Sweaved

  Removing content.xml

  Post-processing the contents
Input is not proper UTF-8, indicate encoding !
Bytes: 0xE2 0x6E 0x63 0x69
Erro: 1: Input is not proper UTF-8, indicate encoding !
Bytes: 0xE2 0x6E 0x63 0x69
>

> tabela2[1:5,] # a piece of table 2
                                    Concordância observada  Kappa p valor
Sexo:                                               1.0000 1.0000   0e+00
Referenciamento para diagnóstico:                   0.6863 0.5081   4e-03
Reteste na doação de sangue:                        0.9379 0.7874   0e+00
Resultado do reteste da doação:                     0.9317 0.6607   2e-04
Indicação médica para investigação:                 0.6957 0.5556   1e-04

Considering some sugestions form other lists I tryed to encode the table
using enc2utf8 and descr::toUTF8 such as

<<tabela2, echo = FALSE, results = xml>>=

odfTable(enc2utf8(tabela2),useRowNames=T,name ='Tabela 2')

@

OR

<<tabela2, echo = FALSE, results = xml>>=

enc2utf8(odfTable(tabela2,useRowNames=T,name ='Tabela 2'))

@

OR

<<tabela2, echo = FALSE, results = xml>>=

toUTF8(odfTable(tabela2,useRowNames=T,name ='Tabela 2'))

@

But all of them gave the same error. However, if I set the table without the
rownames such as:

<<tabela2, echo = FALSE, results = xml>>=

odfTable(tabela2,useRowNames=F,name ='Tabela 2')

@

It works fine... but the rownames are not there. I tryed to bind the
rownames as column but the error comes back.

After a couple days banging my head around Im about to appeal to old friend
"copy and paste". Any sugestion is most welcome.

Kind regards to all and thanks in advance,

Abraço forte e que a força esteja com você,

Dr. Pedro Emmanuel A. A. do Brasil
Instituto de Pesquisa Clínica Evandro Chagas
Fundação Oswaldo Cruz
Rio de Janeiro - Brasil
Av. Brasil 4365
Tel 55 21 3865-9648
email: pedro.brasil@ipec.fiocruz.br
email: emmanuel.brasil@gmail.com

---Apoio aos softwares livres
www.zotero.org - gerenciamento de referências bibliográficas.
www.broffice.org ou www.openoffice.org - textos, planilhas ou apresentações.
www.epidata.dk - entrada de dados.
www.r-project.org - análise de dados.
www.ubuntu.com - sistema operacional

	[[alternative HTML version deleted]]

