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

> Copies UTF-8 characters from one buffer to another as UTF-16.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

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

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

### Parameters

**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The source buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bytes to read from the source.**** (\[char\*]\(https\://learn.microsoft.com/dotnet/api/system.char)): The destination buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Outputs the number of chars written to the destination.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The size in chars of the destination buffer.

### Returns

| Type                                                                                    | Description                                                                                                                                                                                                                                          |
| --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ConversionError](/engine/6000.7/script-reference/unity/collections/conversionerror.md) | [ConversionError.None](/engine/6000.7/script-reference/unity/collections/conversionerror/none.md) if the copy fully completes. Otherwise, [ConversionError.Overflow](/engine/6000.7/script-reference/unity/collections/conversionerror/overflow.md). |

### Remarks

Assumes the source data is valid UTF-8.
