Changeset 36123 in project


Ignore:
Timestamp:
08/11/18 13:54:55 (13 months ago)
Author:
Kooda
Message:

Document the utf8 egg for CHICKEN 5

File:
1 copied

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/utf8

    r36122 r36123  
    2222To make your code Unicode aware, just do the following:
    2323
    24   (require-extension utf8)
     24  (import utf8)
    2525
    2626then all core, extra and regex string operations will be Unicode
     
    4747      string-length string-ref string-set! make-string string substring
    4848      string->list list->string string-fill! write-char read-char display)
    49     (except chicken
    50       reverse-list->string print print*)
    51     (except data-structures
    52       ->string conc string-chop string-split string-translate
    53       substring=? substring-ci=? substring-index substring-index-ci)
    54     (except extras
    55       read-string write-string read-token)
    56     (except regexp
     49    (except (chicken base)
     50      print print*)
     51    (except (chicken string)
     52      reverse-list->string ->string conc string-chop string-split
     53      string-translate substring=? substring-ci=? substring-index
     54      substring-index-ci)
     55    (except (chicken io)
     56      read-string write-string read-token))
     57
     58If you are using the regex egg:
     59
     60  (import
     61    (except regex
    5762      grep regexp string-substitute string-substitute* string-split-fields
    58       string-match string-match-positions string-match-offsets
    59       string-search string-search-positions string-search-offsets) )
     63      string-match string-match-positions string-search string-search-positions))
    6064
    6165''Note'' that not all Chicken string routines have a utf8 version yet:
    6266
    63 ; Unit data-structures : {{string-chomp}}, {{string-compare3}}, {{reverse-string-append}}
    64 ; Unit extras : {{pretty-print}}, {{printf}}, {{sprintf}}, {{fprintf}}, {{read-line}}, {{write-line}}, {{read-lines}}
    65 ; Unit irregex : (already utf8 aware, unless disabled)
    66 ; Unit utils : {{scan-input-lines}}
     67; Module (chicken string) : {{string-chomp}}, {{string-compare3}}, {{reverse-string-append}}
     68; Module (chicken pretty-print) : {{pretty-print}}
     69; Module (chicken format) : {{printf}}, {{sprintf}}, {{fprintf}}
     70; Module (chicken io) : {{read-line}}, {{write-line}}, {{read-lines}}
     71; Module (chicken irregex) : (already utf8 aware, unless disabled)
    6772
    6873To use Unicode-aware SRFI-13 and SRFI-14 using UTF-8 semantics:
    6974
    70   (require-extension utf8-srfi-13)
    71   (require-extension utf8-srfi-14)
     75  (import utf8-srfi-13)
     76  (import utf8-srfi-14)
    7277
    7378The SRFI-14 module provides an alternative to the standard Chicken
     
    8287char-set definitions, use the unicode-char-sets unit:
    8388
    84   (require-extension unicode-char-sets)
     89  (import unicode-char-sets)
    8590
    8691[Note this is the only extension in this egg with a {{unicode-}}
     
    186191lighter-weight. To get full Unicode aware case-mappings, do
    187192
    188   (require-extension utf8-case-map)
     193  (import utf8-case-map)
    189194
    190195which provides the {{utf8-string-upcase}}, {{utf8-string-downcase}},
     
    301306=== Changelog
    302307
     308; 3.5.0 ; Port to CHICKEN 5
    303309; 3.3.0 ;
    304310; 3.2.0 ;
Note: See TracChangeset for help on using the changeset viewer.