You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2012-04-03 10:23:50

iniesta
Member
Registered: 2012-04-03
Posts: 3

problems with accents in CSV

Hi everybody
I have a problem with the accents for Spanish languaje exporting any list to excel choosing the combo csv or slk. the report shows me words as "número de serie"  is displayed as "Número de serie".
Many thanks

Offline

#2 2012-04-03 10:43:24

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: problems with accents in CSV

This is not an issue. The CSV is UTF-8 encoded.

You can import this file in any good software without problem.
(yes, Excel is NOT a good software)


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#3 2012-04-03 11:57:26

eiseli
Member
From: Switzerland
Registered: 2008-06-10
Posts: 148

Re: problems with accents in CSV

Unfortunately, in some companies you don't have the choice which spreadsheet software you can use. The workaround is to use a macro which replaces the wrong characters.
Here's the code I've found somewhere:

Sub utf8()
'
' utf8 Makro
' Convert UTF-8 characters to Excel format
'
' key combination: Strg+w
'

' a acute big
    Cells.Replace What:="Á", Replacement:="Á", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a acute small
    Cells.Replace What:="á", Replacement:="á", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a brevis small
    Cells.Replace What:="ă", Replacement:=ChrW(259), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a cedilla big
    Cells.Replace What:="Ä„", Replacement:=ChrW(260), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a cedilla small
    Cells.Replace What:="Ä…", Replacement:=ChrW(261), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a circumflex big
    Cells.Replace What:="Â", Replacement:="Â", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a circumflex small
    Cells.Replace What:="â", Replacement:="â", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a grave small
    Cells.Replace What:="à", Replacement:="à", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a macron big
    Cells.Replace What:="Ä€", Replacement:=ChrW(256), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a macron small
    Cells.Replace What:="ā", Replacement:=ChrW(257), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a ring big
    Cells.Replace What:="Ã…", Replacement:="Å", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a ring small
    Cells.Replace What:="Ã¥", Replacement:="å", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a tilde small
    Cells.Replace What:="ã", Replacement:="ã", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a umlaut big
    Cells.Replace What:="Ä", Replacement:="Ä", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' a umlaut small
    Cells.Replace What:="ä", Replacement:="ä", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' ae ligature small
    Cells.Replace What:="æ", Replacement:="æ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' ae ligature big
    Cells.Replace What:="Æ", Replacement:="Æ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c acute big
    Cells.Replace What:="Ć", Replacement:=ChrW(262), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c acute small
    Cells.Replace What:="ć", Replacement:=ChrW(263), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c caron big
    Cells.Replace What:="Č", Replacement:=ChrW(268), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c caron small
    Cells.Replace What:="č", Replacement:=ChrW(269), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c cedilla big
    Cells.Replace What:="Ç", Replacement:="Ç", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' c cedilla small
    Cells.Replace What:="ç", Replacement:="ç", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' d dash big
    Cells.Replace What:="Đ", Replacement:=ChrW(272), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' d dash small
    Cells.Replace What:="Ä‘", Replacement:=ChrW(273), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' dh small small
    Cells.Replace What:="ð", Replacement:="ð", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e acute big
    Cells.Replace What:="É", Replacement:="É", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e acute small
    Cells.Replace What:="é", Replacement:="é", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e caron small
    Cells.Replace What:="Ä›", Replacement:=ChrW(283), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e cedilla small
    Cells.Replace What:="Ä™", Replacement:=ChrW(281), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e circumflex small
    Cells.Replace What:="ê", Replacement:="ê", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e grave big
    Cells.Replace What:="È", Replacement:="È", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e grave small
    Cells.Replace What:="è", Replacement:="è", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e macron big
    Cells.Replace What:="Ä’", Replacement:=ChrW(274), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e macron small
    Cells.Replace What:="Ä“", Replacement:=ChrW(275), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e point small
    Cells.Replace What:="Ä—", Replacement:=ChrW(279), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e turned big
    Cells.Replace What:="Ə", Replacement:=ChrW(399), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e turned small
    Cells.Replace What:="É™", Replacement:=ChrW(601), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
    Cells.Replace What:="ǝ", Replacement:=ChrW(601), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' e umlaut small
    Cells.Replace What:="ë", Replacement:="ë", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' g brevis small
    Cells.Replace What:="ÄŸ", Replacement:=ChrW(287), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' g point big
    Cells.Replace What:="Ä ", Replacement:=ChrW(288), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' g point small
    Cells.Replace What:="Ä¡", Replacement:=ChrW(289), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' h macron big
    Cells.Replace What:="Ħ", Replacement:=ChrW(294), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' h macron small
    Cells.Replace What:="ħ", Replacement:=ChrW(295), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i acute big
    Cells.Replace What:="Í", Replacement:="Í", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i acute small
    Cells.Replace What:="Ã", Replacement:="í", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i brevis small
    Cells.Replace What:="Ä", Replacement:=ChrW(301), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i circumflex big
    Cells.Replace What:="ÃŽ", Replacement:="Î", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i circumflex small
    Cells.Replace What:="î", Replacement:="î", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i grave small
    Cells.Replace What:="ì", Replacement:="ì", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i macron big
    Cells.Replace What:="Ī", Replacement:=ChrW(298), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i macron small
    Cells.Replace What:="Ä«", Replacement:=ChrW(299), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i pointed big
    Cells.Replace What:="Ä°", Replacement:=ChrW(304), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i pointless small
    Cells.Replace What:="ı", Replacement:=ChrW(305), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' i umlaut small
    Cells.Replace What:="ï", Replacement:="ï", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' k cedilla big
    Cells.Replace What:="Ķ", Replacement:=ChrW(310), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' k cedilla small
    Cells.Replace What:="Ä·", Replacement:=ChrW(311), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' l cedilla small
    Cells.Replace What:="ļ", Replacement:=ChrW(316), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' l slash big
    Cells.Replace What:="Ł", Replacement:=ChrW(321), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' l slash small
    Cells.Replace What:="Å‚", Replacement:=ChrW(322), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' n acute small
    Cells.Replace What:="Å„", Replacement:=ChrW(324), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' n caron small
    Cells.Replace What:="ň", Replacement:=ChrW(328), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' n cedilla small
    Cells.Replace What:="ņ", Replacement:=ChrW(326), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' n tilde big
    Cells.Replace What:="Ñ", Replacement:="Ñ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' n tilde small
    Cells.Replace What:="ñ", Replacement:="ñ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o acute big
    Cells.Replace What:="Ó", Replacement:="Ó", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o acute small
    Cells.Replace What:="ó", Replacement:="ó", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o brevis big
    Cells.Replace What:="ÅŽ", Replacement:=ChrW(334), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o brevis small
    Cells.Replace What:="ŏ", Replacement:=ChrW(335), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o circumflex small
    Cells.Replace What:="ô", Replacement:="ô", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o double acute big
    Cells.Replace What:="Ö", Replacement:=ChrW(336), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o double acute small
    Cells.Replace What:="Å‘", Replacement:=ChrW(337), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o grave small
    Cells.Replace What:="ò", Replacement:="ò", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o macron big
    Cells.Replace What:="Ō", Replacement:=ChrW(332), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o macron small
    Cells.Replace What:="ō", Replacement:=ChrW(333), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o slash big
    Cells.Replace What:="Ø", Replacement:="Ø", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o slash small
    Cells.Replace What:="ø", Replacement:="ø", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o tilde small
    Cells.Replace What:="õ", Replacement:="õ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' o umlaut small
    Cells.Replace What:="ö", Replacement:="ö", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' r caron big
    Cells.Replace What:="Ř", Replacement:=ChrW(344), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' r caron small
    Cells.Replace What:="Å™", Replacement:=ChrW(345), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' r cedilla small
    Cells.Replace What:="Å—", Replacement:=ChrW(343), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s acute big
    Cells.Replace What:="Åš", Replacement:=ChrW(346), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s acute small
    Cells.Replace What:="Å›", Replacement:=ChrW(347), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s caron big
    Cells.Replace What:="Å ", Replacement:=ChrW(352), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s caron small
    Cells.Replace What:="Å¡", Replacement:=ChrW(353), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s cedilla big
    Cells.Replace What:="Åž", Replacement:=ChrW(350), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' s cedilla small
    Cells.Replace What:="ÅŸ", Replacement:=ChrW(351), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' sz ligature small
    Cells.Replace What:="ß", Replacement:="ß", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' t cedilla big
    Cells.Replace What:="Å¢", Replacement:=ChrW(354), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' t cedilla small
    Cells.Replace What:="Å£", Replacement:=ChrW(355), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' thorn big
    Cells.Replace What:="Þ", Replacement:="Þ", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u acute big
    Cells.Replace What:="Ú", Replacement:="Ú", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u acute small
    Cells.Replace What:="ú", Replacement:="ú", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u brevis big
    Cells.Replace What:="Ŭ", Replacement:=ChrW(364), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u brevis small
    Cells.Replace What:="Å", Replacement:=ChrW(365), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u cedilla small
    Cells.Replace What:="ų", Replacement:=ChrW(371), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u circumflex small
    Cells.Replace What:="û", Replacement:="û", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u double acute small
    Cells.Replace What:="ű", Replacement:=ChrW(369), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u grave small
    Cells.Replace What:="ù", Replacement:="ù", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u macron big
    Cells.Replace What:="Ū", Replacement:=ChrW(362), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u macron small
    Cells.Replace What:="Å«", Replacement:=ChrW(363), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u ring small
    Cells.Replace What:="ů", Replacement:=ChrW(367), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u umlaut big
    Cells.Replace What:="Ãœ", Replacement:="Ü", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' u umlaut small
    Cells.Replace What:="ü", Replacement:="ü", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' y acute small
    Cells.Replace What:="ý", Replacement:="ý", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' z acute small
    Cells.Replace What:="ź", Replacement:=ChrW(378), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' z caron big
    Cells.Replace What:="Ž", Replacement:=ChrW(381), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' z caron small
    Cells.Replace What:="ž", Replacement:=ChrW(382), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' z point big
    Cells.Replace What:="Å»", Replacement:=ChrW(379), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' z point small
    Cells.Replace What:="ż", Replacement:=ChrW(380), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' cedilla
    Cells.Replace What:="̨", Replacement:=ChrW(808), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' diaresis
    Cells.Replace What:="̈", Replacement:=ChrW(776), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' halfcircle, right open
    Cells.Replace What:="´", Replacement:=ChrW(703), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' macron
    Cells.Replace What:="Ì„", Replacement:=ChrW(772), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' macron below
    Cells.Replace What:="̱", Replacement:=ChrW(817), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True
' apostroph
    Cells.Replace What:="ʼ", Replacement:=ChrW(700), LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=True

End Sub

Working environment: Fedora 22, GLPI 0.90.1, upgraded from 0.72.0, 0.78, 0.83 PHP/5.6.16, MySQL/10.0.21-MariaDB, Apache/2.4.17, Firefox 43
Transifex: https://www.transifex.com/accounts/profile/eiseli/

Offline

#4 2012-04-09 09:25:49

iniesta
Member
Registered: 2012-04-03
Posts: 3

Re: problems with accents in CSV

Many thanks for your information, but as eiseli said, i haven't that choice. By the way, the macro works.
Anyway I am still working with the headers for Excel so I will post the solution when done.

Offline

#5 2012-04-11 13:16:56

iniesta
Member
Registered: 2012-04-03
Posts: 3

Re: problems with accents in CSV

I have solve the problem adding the following line "$value=str_replace("í","i",$value);" in the csv_clean function (file export.function.php)

Offline

Board footer

Powered by FluxBB