Revision history for KeyPgWstring


Revision [21709]

Last edited on 2016-11-18 04:27:33 by fxm [Suppressing the link to itself]
Deletions:
- ##[[KeyPgWstring|Wstring]]## (data type)


Revision [21660]

Edited on 2016-11-03 13:46:38 by DkLwikki [Mention the need for BOM]
Additions:
When processing source files, ""FreeBASIC"" can parse ASCII files with Unicode escape sequences (\u), or UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE files, as long as they were saved with Byte Order Mark (BOM).
Deletions:
When processing source files, ""FreeBASIC"" can parse ASCII files with Unicode escape sequences (\u), UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE.


Revision [21195]

Edited on 2016-03-13 12:00:45 by fxm [Formatting]
Additions:







Revision [20612]

Edited on 2016-02-10 16:11:20 by DkLwikki [Update link format]
Additions:
[[KeyPgDim|dim]] //variable// [[KeyPgAs|as]] **Wstring** * //size//
[[KeyPgDim|dim]] //variable// [[KeyPgAs|as]] **Wstring** [[KeyPgPtr|ptr]]
A ##**Wstring**## is a fixed-size array of wide-chars that never overflows if the size is known at compile-time. It has no descriptor, and does never resize unless it's a pointer and ##[[KeyPgAllocate|Allocate]]##/##[[KeyPgReallocate|Reallocate]]##/##[[KeyPgDeallocate|Deallocate]]## are used directly. When the variable has a fixed ##//size//##, ""FreeBASIC"" avoids any overflow that could occur on assignment, by truncating the contents to a length of ##//size// - 1##.
In a ##**Wstring**##, ##[[KeyPgLen|Len]]## returns the size of the contained string and ##[[KeyPgSizeof|Sizeof]]## returns the space allocated to the ##**Wstring**##. ##[[KeyPgSizeof|Sizeof]]## only works if the size is known by the compiler, i.e. a fixed-size ##**Wstring**## variable is passed directly, not as a dereferenced pointer or a ##[[KeyPgByref|Byref]]## function argument.
This type is provided for support non-Latin based alphabets. Any intrinsic string function like ##[[KeyPgLeft|Left]]## will work with ##**Wstring**##s too, as will any string operator.
The ""FreeBASIC"" text file functions can read and write Unicode files in different encodings, provided the ##[[KeyPgEncoding|encoding]]## is specified when the file is opened. The text is automatically converted to the internal encoding at read and converted back to the file encoding at write.
##[[KeyPgSizeof|sizeof]]##( ##**Wstring**## ) returns the number of bytes used by a ##**Wstring**## character in the current platform.
- Unicode is not supported in the DOS port of ""FreeBASIC"". In this port a character takes up always 1 byte and ##[[KeyPgWstring|Wstrings]]## will behave as standard ASCII ##[[KeyPgZstring|Zstrings]]##
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Wstring""**##.
- ##[[KeyPgString|String]]## (data type)
- ##[[KeyPgZstring|Zstring]]## (data type)
- ##[[KeyPgWstring|Wstring]]## (data type)
- ##[[KeyPgStringFunction|String]]## (function)
- ##[[KeyPgWstringFunction|Wstring]]## (function)
- ##[[KeyPgWspace|Wspace]]##
- ##[[KeyPgWstr|Wstr]]##
- ##[[KeyPgWchr|Wchr]]##
- ##[[KeyPgWbin|Wbin]]##
- ##[[KeyPgWhex|Whex]]##
- ##[[KeyPgWoct|Woct]]##
- ##[[KeyPgWinput|Winput()]]##
Deletions:
[[KeyPgDim dim]] //variable// [[KeyPgAs as]] **Wstring** * //size//
[[KeyPgDim dim]] //variable// [[KeyPgAs as]] **Wstring** [[KeyPgPtr ptr]]
A ##**Wstring**## is a fixed-size array of wide-chars that never overflows if the size is known at compile-time. It has no descriptor, and does never resize unless it's a pointer and ##[[KeyPgAllocate Allocate]]##/##[[KeyPgReallocate Reallocate]]##/##[[KeyPgDeallocate Deallocate]]## are used directly. When the variable has a fixed ##//size//##, ""FreeBASIC"" avoids any overflow that could occur on assignment, by truncating the contents to a length of ##//size// - 1##.
In a ##**Wstring**##, ##[[KeyPgLen Len]]## returns the size of the contained string and ##[[KeyPgSizeof Sizeof]]## returns the space allocated to the ##**Wstring**##. ##[[KeyPgSizeof Sizeof]]## only works if the size is known by the compiler, i.e. a fixed-size ##**Wstring**## variable is passed directly, not as a dereferenced pointer or a ##[[KeyPgByref Byref]]## function argument.
This type is provided for support non-Latin based alphabets. Any intrinsic string function like ##[[KeyPgLeft Left]]## will work with ##**Wstring**##s too, as will any string operator.
The ""FreeBASIC"" text file functions can read and write Unicode files in different encodings, provided the ##[[KeyPgEncoding encoding]]## is specified when the file is opened. The text is automatically converted to the internal encoding at read and converted back to the file encoding at write.
##[[KeyPgSizeof sizeof]]##( ##**Wstring**## ) returns the number of bytes used by a ##**Wstring**## character in the current platform.
- Unicode is not supported in the DOS port of ""FreeBASIC"". In this port a character takes up always 1 byte and ##[[KeyPgWstring Wstrings]]## will behave as standard ASCII ##[[KeyPgZstring Zstrings]]##
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Wstring""**##.
- ##[[KeyPgString String]]## (data type)
- ##[[KeyPgZstring Zstring]]## (data type)
- ##[[KeyPgWstring Wstring]]## (data type)
- ##[[KeyPgStringFunction String]]## (function)
- ##[[KeyPgWstringFunction Wstring]]## (function)
- ##[[KeyPgWspace Wspace]]##
- ##[[KeyPgWstr Wstr]]##
- ##[[KeyPgWchr Wchr]]##
- ##[[KeyPgWbin Wbin]]##
- ##[[KeyPgWhex Whex]]##
- ##[[KeyPgWoct Woct]]##
- ##[[KeyPgWinput Winput()]]##


Revision [17852]

Edited on 2015-12-18 20:48:08 by DoS386 [killed some whitespace, bracketed ""FreeBASIC"", some improvements as discussed in forum]
Additions:
When processing source files, ""FreeBASIC"" can parse ASCII files with Unicode escape sequences (\u), UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE.
The ""FreeBASIC"" text file functions can read and write Unicode files in different encodings, provided the ##[[KeyPgEncoding encoding]]## is specified when the file is opened. The text is automatically converted to the internal encoding at read and converted back to the file encoding at write.
- On ""Win32"" wstrings are encoded in UCS-2 and a character takes up always 2 bytes. This is actually not UTF-16 LE, as ""FreeBASIC"" doesn't bother with surrogates introduced in Win XP. This further means that what ""FreeBASIC"" understands with a character may not represent a full codepoint.
Deletions:

Besides ASCII files with Unicode escape sequences (\u), FreeBASIC can parse UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE source files.
The FreeBASIC text file functions can read and write Unicode files in different encodings, provided the ##[[KeyPgEncoding encoding]]## is specified when the file is opened. The text is automatically converted to the internal encoding at read and converted back to the file encoding at write.

- On ""Win32"" wstrings are encoded in UCS-2 (UTF-16 LE) and a character takes up 2 bytes.


Revision [17572]

Edited on 2015-04-01 13:22:47 by DkLwikki [quotes to prevent links]
Additions:
- Unicode is not supported in the DOS port of ""FreeBASIC"". In this port a character takes up always 1 byte and ##[[KeyPgWstring Wstrings]]## will behave as standard ASCII ##[[KeyPgZstring Zstrings]]##
- On ""Win32"" wstrings are encoded in UCS-2 (UTF-16 LE) and a character takes up 2 bytes.
Deletions:
- Unicode is not supported in the DOS port of FreeBASIC. In this port a character takes up always 1 byte and ##[[KeyPgWstring Wstrings]]## will behave as standard ASCII ##[[KeyPgZstring Zstrings]]##
- On Win32 wstrings are encoded in UCS-2 (UTF-16 LE) and a character takes up 2 bytes.


Revision [17347]

Edited on 2014-10-24 03:37:00 by FxMwikki [Clarification]
Additions:
A ##**Wstring**## is a fixed-size array of wide-chars that never overflows if the size is known at compile-time. It has no descriptor, and does never resize unless it's a pointer and ##[[KeyPgAllocate Allocate]]##/##[[KeyPgReallocate Reallocate]]##/##[[KeyPgDeallocate Deallocate]]## are used directly. When the variable has a fixed ##//size//##, ""FreeBASIC"" avoids any overflow that could occur on assignment, by truncating the contents to a length of ##//size// - 1##.
The end of the string is marked by the character 0 automatically added by the ""FreeBASIC"" string handling functions, so that character must never be part of a ##**Wstring**## or the content will be truncated. The character 0 will be appended when the string is created, and the length will be calculated by scanning the string for the first null character.
In a ##**Wstring**##, ##[[KeyPgLen Len]]## returns the size of the contained string and ##[[KeyPgSizeof Sizeof]]## returns the space allocated to the ##**Wstring**##. ##[[KeyPgSizeof Sizeof]]## only works if the size is known by the compiler, i.e. a fixed-size ##**Wstring**## variable is passed directly, not as a dereferenced pointer or a ##[[KeyPgByref Byref]]## function argument.
dim as wstring * 13 str1 => "hello, world"
print sizeof(str1) 'returns 13 * sizeof(wstring), the number of bytes used by the variable
str2 = allocate( 13 * len(wstring) )
Deletions:
A ##**Wstring**## is a fixed-size array of wide-chars that never overflows if the size is known at compile-time. It has no descriptor, and does never resize unless it's a pointer and ##[[KeyPgAllocate Allocate]]##/##[[KeyPgReallocate Reallocate]]##/##[[KeyPgDeallocate Deallocate]]## are used directly.
The end of the string is marked by the character 0, so that character must never be part of a ##**Wstring**## or the content will be truncated.
dim as wstring * 14 str1 => "hello, world"
print sizeof(str1) 'returns 14 * sizeof(wstring), the number of bytes used by the variable
str2 = allocate( 14 * len(wstring) )


Revision [14473]

Edited on 2009-08-29 21:57:50 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]
Additions:
- New to ""FreeBASIC""
Deletions:
- New to FreeBASIC


Revision [13292]

The oldest known version of this page was created on 2008-04-27 22:11:58 by DoS386 [Remove CamelCase links in "New to FreeBASIC"]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode