Skip to content
Prev 333763 / 398506 Next

Coding systems.

Hello,

as Jan pointed out the problem is with the encoding in which R saves the
fucntion.  If I set this encoding to "UTF-8" in source everything is fine.

If I go either in my .bash_profile or my .Renviron file and set all LOCALE
variables to "fr_CA.UTF8" it should do the job, and to a certain point it
does, I can source, and save in my personnal library functions with
multibyte characters and they will run as expected.

BUT with these settings

at startup R throws the following error:

Erreur : caract?res multioctets incorrects dans l'analyse de code (parser)
? la ligne 28

which translates in something like:

Error: incorrect multi-byte characters in the code analysis (parser) at
line 28

Further more I can't install any package, install.packages returns the same
error and stops execution???

I know the work around is to not specify an UTF-8 locale in my profiles and
explicitly pass the argument "encoding = 'UTF-8'" to source.  But to me,
this is somewhat of an inconsistency!!!

Thanks to Jan for his insights,

G?rald
                                                                                   
 (Embedded image moved to file:                                                    
 pic09232.gif)                                                                     
                                                                                   
 Gerald Jean, M. Sc. en statistiques                                               
 Conseiller senior en statistiques     L?vis (si?ge social)                        
                                                                                   
 Actuariat corporatif,                 418 835-4900, poste                         
 Mod?lisation et Recherche             7639                                        
 Assurance de dommages                 1 877 835-4900, poste                       
 Mouvement Desjardins                  7639                                        
                                       T?l?copieur : 418                           
                                       835-6657                                    
                                                                                   


                                                                                  
 Faites bonne impression et imprimez seulement au besoin!                         
                                                                                  
 Ce courriel est confidentiel, peut ?tre prot?g? par le secret professionnel et   
 est adress? exclusivement au destinataire. Il est strictement interdit ? toute   
 autre personne de diffuser, distribuer ou reproduire ce message. Si vous l'avez  
 re?u par erreur, veuillez imm?diatement le d?truire et aviser l'exp?diteur.      
 Merci.                                                                           
                                                                                  





                                                                           
             Jan van der Laan                                              
             <rhelp at eoos.dds.n                                             
             l>                                                          A 
                                       r-help at r-project.org                
             2013/11/27 02:26                                           cc 
                                       gerald.jean at dgag.ca                 
                                                                     Objet 
                                       Re: [R] Coding systems.             
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Could it be that your r-script is saved in a different encoding than
the one used by R (which will probably be UTF8 since you're working on
linux)?

--
Jan



gerald.jean at dgag.ca schreef:
playing
==============================================================================
"Winnipeg",
(Ontario",
==============================================================================
"test2.sima.31122012.DataPrep"
==============================================================================
==============================================================================
"Montr?al"
==============================================================================
"LC_CTYPE=fr_CA;LC_NUMERIC=C;LC_TIME=fr_CA;LC_COLLATE=fr_CA;LC_MONETARY=fr_CA;LC_MESSAGES=fr_CA;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_CA;LC_IDENTIFICATION=C"
l'exp?diteur.