[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [NOVICE] hvordan afgøres en fils tegnsæt



Kristian Nørgaard skrev:

> Hvordan kan jeg afgøre, hvilket tegnsæt en tekstfil er indkodet med?

Det kan du ikke (på et almindeligt linuxsystem).

> F.eks. om en tekstfil er utf-8 eller ISO-8859-1 ?

UTF-8 er lidt specielt, da det ikke er alle bitmønstre der svarer til
en korrekt UTF-8-kodet tekst.  Det betyder at der er mulighed for at
gætte om en tekst er kodet med ISO-8859-1 eller UTF-8.  Og hvis der
kun er de to muligheder, så tror jeg gættet vil være rigtigt næsten
hver gang.

Denne funktion til Bash giver et kvalificeret gæt på om en fil er
kodet med UTF-8 eller ISO-8859-1:

   kodning () {
      if iconv -t iso-8859-1 -f utf-8 2>&1 < $1 > /dev/null 2>&1; then
         echo UTF-8
      else
         echo ISO-8859-1
      fi
   }

> Og hvordan kan jeg ændre det?

Med `iconv`.

Jacob
-- 
Growing older is compulsory. Growing up isn't.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 21:16 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *