Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

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

Definition

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

Utf8ToUtf16(byte*, int, char*, int, int)

public static ConversionError Utf8ToUtf16(byte* utf8Buffer, int utf8Length, char* utf16Buffer, out int utf16Length, int utf16Capacity)

Parameters

utf8Buffer

The source buffer.

utf8Length

The number of bytes to read from the source.

utf16Buffer

The destination buffer.

utf16Length

Outputs the number of chars written to the destination.

utf16Capacity

The size in chars of the destination buffer.

Returns

Type

Description

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

Remarks

Assumes the source data is valid UTF-8.