commonlib.Encoding

encoding functions

Title encoding functions
Author(s) LiXizhi
Date 2008/12/10
File script/ide/Encoding.lua

Description

file encoding is a very complicated issue. if the npl file encoding is set to utf8 ( usually without signature), then to display a file, one usually needs to convert from system default encoding to utf8 and vice versa. However, it is still impossible to display a file name created in one encoding system and opened in another.

TIP Sample Code

NPL.load("(gl)script/ide/Encoding.lua");
commonlib.Encoding.Utf8ToDefault(text)
commonlib.Encoding.DefaultToUtf8(text)

print(commonlib.Encoding.SortCSVString("Cword,Aword,Bword"))

Member Functions

commonlib.Encoding.SortCSVString

sort commar separated vector (CSV) string alphabetically

  • param fields : string such as "C,B,A", or a table containing string arrays such as {"C", "B", "A"}
  • return return : a new CSV string "A,B,C"

syntax

function commonlib.Encoding.SortCSVString(fields)

parameters

fields string such as "C,B,A", or a table containing string arrays such as {"C", "B", "A"}
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback