The LegacyStrings package provides compatibility string types from Julia 0.5 (and earlier), which were removed in subsequent versions, including:
ASCIIString
: a single-byte-per character string type that can only hold ASCII string data.UTF8String
: a string type with single byte code units (UInt8
), encoding strings as UTF-8.UTF16String
: a string type with two-byte native-endian code units (UInt16
), encoding strings as UTF-16.UTF32String
: a string type with four-byte native-endian code units (UInt32
), encoding strings as UTF-32.ByteString
: a type alias forUnion{ASCIIString,UTF8String}
, i.e. strings that can be passed to C directly.WString
: an alias forUTF16String
ifCwchart_t
is two bytes (i.e. Windows) orUTF32String
otherwise.RepString
: a string type for efficient handling of repeated strings.
LegacyStrings also defines and exports converter functions for these types, i.e.:
ascii
: convert toASCIIString
; on 0.5 sinceBase
exports anascii
function as well, you must explicitly doimport LegacyStrings: ascii
or writeLegacyStrings.ascii
in order to use this function rather thanBase.ascii
.utf8
: convert toUTF8String
.utf16
: convert toUTF16String
.utf32
: convert toUTF32String
.wstring
: alias forutf16
orutf32
according to whatWString
is an alias to.
The definitions of the above types and functions are conditional on the version of Julia being used so that you can do using LegacyStrings
unconditionally and be guaranteed that e.g. LegacyStrings.ASCIIString
is an ASCIIString
type that will behave as expect in Julia 0.4 or earlier.