> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# toUtf8String

> **注意**: 此页面尚未翻译成中文。以下内容为英文原版。

```ts theme={null}
function toUtf8String(bytes, onError?): string
```

Returns the string represented by the UTF-8 data `bytes`.

When `onError` function is specified, it is called on UTF-8 errors allowing recovery using the
[**Utf8ErrorFunc**](https://docs.qu.ai/cn/sdk/content/type-aliases/Utf8ErrorFunc.md) API. (default: [error](Utf8ErrorFuncs))

## Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `bytes` | [`BytesLike`](https://docs.qu.ai/cn/sdk/content/type-aliases/BytesLike) | The UTF-8 data to convert. |
| `onError`? | [`Utf8ErrorFunc`](https://docs.qu.ai/cn/sdk/content/type-aliases/Utf8ErrorFunc) | The error handling function. |

## Returns

`string`

The string.

## Source

[encoding/utf8.ts:348](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/encoding/utf8.ts#L348)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.