stream_set_byte_order stream_set_swap_bytes navigation bar

Table of Contents

stream_set_character_format

Sets the character format of the stream.

Syntax

stream_set_character_format(stream, format)
stream_set_character_format(stream)
    

Description

Determines whether the functions that send and receive characters use Unicode UTF8, UTF16 or UTF32 or determine the character format automatically from the first characters read from the stream.

The FORMAT argument may be one of the following values:

'auto'

= character format is determined from byte order mark (if present) read from the stream.

'ascii'

= use the Unicode UTF8 character set (8-bit Unicode) since it is equivalent to ASCII for the first 127 (0x7f) characters

'unicode'

= use the Unicode character set native to the operating system. For example, on Windows it will be UTF16 but on Linux it will be UTF8

'utf8'

= use the Unicode UTF8 character set (8-bit Unicode)

'utf16'

= use the Unicode UTF16 character set (16-bit Unicode)

'utf32'

= use the Unicode UTF32 character set (32-bit Unicode)

'multibyte'

= use a multibyte character set (based on current locale and code page)

This operation is not valid on listening streams created using stream_listen.

Parameters

stream

Stream handle returned by stream_connect or stream_accept.

format

A string indicating the character format to use. See the Description above for details. If this argument is omitted then it defaults to 'auto'.

Outputs

This function has no outputs.

Examples

stream_set_character_format(stream, 'utf8');    % Sets the character format of the specified stream to UTF-8.
    

See Also

 

navigation bar