Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Utf16ToUtf8(char*, int, byte*, out int, int)

Copies UTF-16 characters from one buffer to another buffer as UTF-8.
Read time 1 minuteLast updated 11 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

Utf16ToUtf8(char*, int, byte*, int, int)

public static ConversionError Utf16ToUtf8(char* utf16Buffer, int utf16Length, byte* utf8Buffer, out int utf8Length, int utf8Capacity)

Parameters

utf16Buffer

The source buffer.

utf16Length

The number of chars to read from the source.

utf8Buffer

The destination buffer.

utf8Length

Outputs the number of bytes written to the destination.

utf8Capacity

The size in bytes of the destination buffer.

Returns

Type

Description

ConversionErrorConversionError.None if the copy fully completes. Otherwise, returns ConversionError.Overflow.

Remarks

Assumes the source data is valid UTF-16.