# Utf8ToUcs(out Rune, byte*, ref int, int)

> Reads a UTF-8 encoded character from a buffer.

## Definition

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

## Utf8ToUcs(Rune, byte\*, int, int)

```csharp
public static ConversionError Utf8ToUcs(out Unicode.Rune rune, byte* buffer, ref int index, int capacity)
```

### Parameters

**** (\[Rune]\(/engine/6000.7/script-reference/unity/collections/unicode/rune)): Outputs the character read. If the read fails, outputs [Unicode.ReplacementCharacter](/engine/6000.7/script-reference/unity/collections/unicode/replacementcharacter.md).**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The buffer of bytes to read.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Reference to a byte index into the buffer. If the read succeeds, index is incremented by the size in bytes of the character read. If the read fails, index is incremented by 1.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The size in bytes of the buffer. Used to check that the read is in bounds.

### 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 read succeeds. Otherwise, returns [ConversionError.Overflow](/engine/6000.7/script-reference/unity/collections/conversionerror/overflow.md) or [ConversionError.Encoding](/engine/6000.7/script-reference/unity/collections/conversionerror/encoding.md). |
