PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • What is UNICODE
  • Managing UNICODE
  • Implicit conversions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
What is UNICODE
UNICODE is an encoding system that assigns a unique number to each character:
  • This system uses a 16-bit encoding.
  • This number can be read regardless of the platform, software or language used.
Unicode supports most of the world's writing systems.
Unicode is used:
  • for character strings
  • for data files
  • for controls that display data from character strings or data files.
Managing UNICODE
To use the UNICODE standard, WINDEV includes:
  • an option to define the string format at runtime in the project configuration description.
    To change the string format in the current configuration:
    1. Open the project description window: on the "Project" tab, in the "Project configuration" group, click "Current configuration".
    2. In the window that appears, go to the "Unicode" tab and select the desired mode: "Use ANSI strings at runtime" or "Use UNICODE strings at runtime".
  • the UNICODE String type.
  • conversion functions:
    These functions convert ANSI characters to Unicode and vice versa. Character strings are automatically converted (see paragraph below).
    Versions 09 and later
    AnsiToUnicode
    New in version 09
    AnsiToUnicode
    AnsiToUnicode
    Converts:
    • an ANSI string (Windows) to a UNICODE string.
    • a buffer containing an ANSI string (Windows) to a buffer containing a UNICODE string.
    Versions 10 and later
    StringToUTF8
    New in version 10
    StringToUTF8
    StringToUTF8
    Converts an ANSI or UNICODE string to UTF-8.
    Versions 09 and later
    UnicodeToAnsi
    New in version 09
    UnicodeToAnsi
    UnicodeToAnsi
    Converts:
    • a UNICODE string to ANSI (Windows).
    • a buffer containing a UNICODE string to a buffer containing an ANSI string (Windows).
    Versions 10 and later
    UTF8ToString
    New in version 10
    UTF8ToString
    UTF8ToString
    Converts a UTF-8 string to ANSI or UNICODE.
  • functions to handle character strings:
    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
    StringFormat
    New in version 09
    StringFormat
    StringFormat
    Formats a character string according to the selected options.
    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 in an array.
    Versions 09 and later
    Complete
    New in version 09
    Complete
    Complete
    Returns a character string of a specified length.
    Versions 09 and later
    CompleteDir
    New in version 09
    CompleteDir
    CompleteDir
    Adds a backslash to the end of a string, if necessary.
    Versions 09 and later
    Right
    New in version 09
    Right
    Right
    Extracts the right part (i.e., the last characters) from a string or buffer.
    Versions 09 and later
    ExtractString
    New in version 09
    ExtractString
    ExtractString
    Allows you to:
    • extract a substring from a string based on a specified string separator.
    • search for substrings in a string based on a specified string separator.
    Versions 09 and later
    Left
    New in version 09
    Left
    Left
    Extracts the left part (i.e., the first characters) from a string or buffer.
    Versions 09 and later
    Reverse
    New in version 09
    Reverse
    Reverse
    Returns the character that corresponds to the difference between the ASCII code of a specific character in a string and 255.
    Versions 09 and later
    Middle
    New in version 09
    Middle
    Middle
    Extracts:
    • a substring from a string starting at a specified position.
    • part of a buffer starting at a specified position.
    Versions 09 and later
    Position
    New in version 09
    Position
    Position
    Finds the position of a specified string within another string.
    Versions 09 and later
    PositionOccurrence
    New in version 09
    PositionOccurrence
    PositionOccurrence
    Finds the Xth position of a string within another string.
    Versions 09 and later
    Replace
    New in version 09
    Replace
    Replace
    Replaces all occurrences of a specified substring in a string with another specified substring.
    Versions 09 and later
    RepeatString
    New in version 09
    RepeatString
    RepeatString
    Concatenates N number of copies of the same specified string or buffer.
    Versions 09 and later
    NoAccent
    New in version 09
    NoAccent
    NoAccent
    Converts accented characters in a string to non-accented characters.
    Versions 09 and later
    NoSpace
    New in version 09
    NoSpace
    NoSpace
    Returns a string after removing the spaces:
    • from the left and right side of the initial string.
    • within the string.
    Versions 09 and later
    Length
    New in version 09
    Length
    Length
    Returns:
    • the length of a string, i.e., the number of characters in the string (including spaces and binary zeros).
    • the size of a buffer, i.e., the number of bytes in the buffer.
    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.
  • operators to handle character strings:
  • operators to iterate over character strings:
  • functions to handle text files:
    fOpenOpens an external file (ANSI or Unicode) to handle it programmatically.
    fReadReads a block of bytes (characters) from an external file (ANSI or UNICODE).
    fReadLineReads a line from an external file (ANSI or UNICODE).
    fWriteWrites a string to an external file (ANSI or UNICODE).
    fWriteLineWrites a line into a text file (ANSI or UNICODE).

Implicit conversions

Starting with version 12, ANSI and Unicode strings are automatically converted. These conversions are performed using the current character set (defined with ChangeCharset).
Versions 15 and later
Starting with version 15, UNICODE strings are automatically converted when one of the following types is assigned to an HFSQL item: boolean, integer (any size, signed or unsigned), currency, numeric or real.
New in version 15
Starting with version 15, UNICODE strings are automatically converted when one of the following types is assigned to an HFSQL item: boolean, integer (any size, signed or unsigned), currency, numeric or real.
Starting with version 15, UNICODE strings are automatically converted when one of the following types is assigned to an HFSQL item: boolean, integer (any size, signed or unsigned), currency, numeric or real.
Use cases:
// 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 version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment