PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • What is the UNICODE format
  • Managing the UNICODE
  • Implicit conversions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Managing the Unicode format in the character strings
What is the UNICODE format
The UNICODE format is an encoding system that assigns a unique number to each character. This encoding is performed on 16 bits. This number can be read regardless of the platform, software or language used.
The Unicode format can support all the character sets of the planet.
The management of the Unicode format is taken into account:
  • when managing the character strings
  • when managing the data files
  • when managing the controls that display data coming from character strings or data files.
Managing the UNICODE
To manage the UNICODE format, WINDEV proposes:
  • the UNICODE String type
  • conversion functions:
    These functions are used to perform conversions from Ansi to Unicode and from Unicode to Ansi. These conversions are automatically performed when handling character strings (see the next paragraph).
    Versions 09 and later
    AnsiToUnicode
    New in version 09
    AnsiToUnicode
    AnsiToUnicode
    Converts:
    • a character string in ANSI format (Windows) into a character string in UNICODE format.
    • a buffer containing a character string in ANSI format (Windows) into a buffer containing a character string in UNICODE format.
    Versions 10 and later
    StringToUTF8
    New in version 10
    StringToUTF8
    StringToUTF8
    Converts a string in ANSI or UNICODE format into a string in UTF8 format.
    Versions 09 and later
    UnicodeToAnsi
    New in version 09
    UnicodeToAnsi
    UnicodeToAnsi
    Converts:
    • a character string in UNICODE format into a character string in ANSI format (Windows).
    • a buffer containing a character string in UNICODE format into a buffer containing a character string in ANSI format (Windows).
    Versions 10 and later
    UTF8ToString
    New in version 10
    UTF8ToString
    UTF8ToString
    Converts a string in UTF8 format into a string in ANSI or UNICODE format.
  • the use of functions for handling the character strings:
    Versions 09 and later
    Complete
    New in version 09
    Complete
    Complete
    Returns a character string of a given size.
    Versions 09 and later
    CompleteDir
    New in version 09
    CompleteDir
    CompleteDir
    Adds (if necessary) the "\" character at the end of a character string.
    Versions 09 and later
    ExtractString
    New in version 09
    ExtractString
    ExtractString
    Used to:
    • extract a sub-string from a character string according to a given string separator.
    • browse the sub-strings in a character string according to a given string separator.
    Versions 09 and later
    Left
    New in version 09
    Left
    Left
    Extracts the left part (which means the first characters) from a character string or from a buffer.
    Versions 09 and later
    Length
    New in version 09
    Length
    Length
    Returns:
    • the size of a character string, which means the number of characters found in the character string (including the space and binary 0 characters).
    • the size of a buffer, which means the number of bytes found in the buffer.
    Versions 09 and later
    Middle
    New in version 09
    Middle
    Middle
    Extracts
    • a sub-string from a given position in a string.
    • a section from a given position in a buffer.
    Versions 09 and later
    NoAccent
    New in version 09
    NoAccent
    NoAccent
    Transforms the accented characters found in a character string into non-accented characters.
    Versions 09 and later
    NoSpace
    New in version 09
    NoSpace
    NoSpace
    Returns a character string without the space characters
    • found on the right and on the left.
    • found inside the string.
    Versions 09 and later
    Position
    New in version 09
    Position
    Position
    Finds the position of a character string inside another character string.
    Versions 09 and later
    PositionOccurrence
    New in version 09
    PositionOccurrence
    PositionOccurrence
    Finds the Xth position of a character string in a character string.
    Versions 09 and later
    RepeatString
    New in version 09
    RepeatString
    RepeatString
    Concatenates N repetitions of the same character string or buffer.
    Versions 09 and later
    Replace
    New in version 09
    Replace
    Replace
    Replaces all the occurrences of a word found in a string by another word.
    Versions 09 and later
    Reverse
    New in version 09
    Reverse
    Reverse
    Returns the complement to 255 for each character found in a character string.
    Versions 09 and later
    Right
    New in version 09
    Right
    Right
    Extracts the right part (which means the last characters) from a character string or from a buffer.
    Versions 09 and later
    StringCompare
    New in version 09
    StringCompare
    StringCompare
    Compares two strings character by character:
    • according to the sequence of ASCII characters.
    • according to the alphabetical order.
    Versions 09 and later
    StringCount
    New in version 09
    StringCount
    StringCount
    Calculates
    • the number of occurrences of a specific character string (by respecting the search criteria) in another character string.
    • the number of occurrences of a set of strings found in an array
    Versions 09 and later
    StringFormat
    New in version 09
    StringFormat
    StringFormat
    Formats a character string according to the selected options.
    Versions 09 and later
    TypeVar
    New in version 09
    TypeVar
    TypeVar
    Identifies the type of an expression, a variable (during a call to a procedure for example) or a control.
    Versions 09 and later
    Val
    New in version 09
    Val
    Val
    Returns the numeric value of a character string.
  • the use of operators for handling the character strings:
  • the use of operators for browsing the character strings:
  • the use of functions for handling the text files:
    fWriteWrites a character string into an external file (ANSI or UNICODE format).
    fWriteLineWrites a line into a text file (in ANSI or UNICODE format).
    fReadReads a block of bytes (characters) in an external file (ANSI or UNICODE).
    fReadLineReads a line in an external file (in ANSI or UNICODE format).
    fOpenOpens an external file (ANSI or Unicode) to handle it by programming.

Implicit conversions

From version 12, the conversions are implicitly performed between the character strings in ANSI format and the character strings in UNICODE format. These conversions are performed by using the current character set (defined by ChangeCharset).
Versions 15 and later
From version 15, the UNICODE character strings are automatically converted when assigned to a HFSQL item of following types: boolean, integer (any size, signed or unsigned), currency, numeric or real.
New in version 15
From version 15, the UNICODE character strings are automatically converted when assigned to a HFSQL item of following types: boolean, integer (any size, signed or unsigned), currency, numeric or real.
From version 15, the UNICODE character strings are automatically converted when assigned to a HFSQL item of following types: boolean, integer (any size, signed or unsigned), currency, numeric or real.
Some examples:
// With the conversion functions
ResU is UNICODE string = AnsiToUnicode("Test of a string")
// Implicit conversion
ResU is UNICODE string = "Test of a string"
Res is string
ResU is UNICODE string
// With the conversion functions
ResU = AnsiToUnicode(Res)
Res = UnicodeToAnsi(ResU)
// Implicit conversion
ResU = Res
Res = ResU
Res is string
ResU is UNICODE string
// With the conversion functions
IF ResU <> AnsiToUnicode("") THEN ...
IF ResU <> AnsiToUnicode(Res) THEN ...
// Implicit conversion
IF ResU <> "" THEN ...
IF ResU <> Res THEN...
nFil is int = fOpen("E:\temp\Unicode.txt", foRead + foUnicode)
ResU is UNICODE string
ResU = fReadLine(nFile)
WHILE ResU <> EOT
Trace(ResU)
ResU = fReadLine(nFile)
END
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment