Difference between revisions of "UTF8 Tools"

From Free Pascal wiki
Jump to navigationJump to search
Line 7: Line 7:
 
= UTF-8 Tools =
 
= UTF-8 Tools =
 
== Purpose ==
 
== Purpose ==
Some tools for common problems with UTF-8/Unicode.
+
Some tools for common problems with UTF-8 / Unicode.
  
 
* charencstreams.pas: Load and save data from almost any text source like  
 
* charencstreams.pas: Load and save data from almost any text source like  
Line 13: Line 13:
 
** big or little endian
 
** big or little endian
 
** BOM or no BOM
 
** BOM or no BOM
 +
   
 +
Simple usage:
 +
    fCES := TCharEncStream.Create;
 +
    fCES.LoadFromFile(OpenDialog1.FileName);
 +
    Memo1.text := fCES.UTF8Text; 
 +
    fCES.free;
  
 
* character.pas: Get Information about code points using the TCharacter class.
 
* character.pas: Get Information about code points using the TCharacter class.
  
* utf8scanner.pas: Access UTF-8 Strings by code index, use case statements on UTF-8 Strings and more...
+
* utf8scanner.pas: Access UTF-8 strings by code index, use case statements on UTF-8 strings and more...
  
 
== Download ==
 
== Download ==
 
[http://www.theo.ch/lazarus/utf8tools.zip Donwload utf8tools.zip]
 
[http://www.theo.ch/lazarus/utf8tools.zip Donwload utf8tools.zip]

Revision as of 12:10, 9 July 2009

About

Sharing some of my code


UTF-8 Tools

Purpose

Some tools for common problems with UTF-8 / Unicode.

  • charencstreams.pas: Load and save data from almost any text source like
    • ansi, UTF8, UTF16, UTF32
    • big or little endian
    • BOM or no BOM

Simple usage:

   fCES := TCharEncStream.Create;
   fCES.LoadFromFile(OpenDialog1.FileName);
   Memo1.text := fCES.UTF8Text;  
   fCES.free;
  • character.pas: Get Information about code points using the TCharacter class.
  • utf8scanner.pas: Access UTF-8 strings by code index, use case statements on UTF-8 strings and more...

Download

Donwload utf8tools.zip