---
title: utf8.substr
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/unicode/utf8-substr
---

```
STRING utf8.substr(STRING s, INTEGER offset, INTEGER length?)
```

**Available in:** all subroutines

Returns a substring of the UTF-8 string `s`, starting from the Unicode code
point `offset`, of Unicode code point `length`. The substring is a copy of the
original bytes.

For example, `substr("%u{3b1}%u{3b2}%u{3b3}", 1, 1)` is `"β"`.
See `substr()` for the exact semantics of the
`offset` and `length`.

If the input string is not valid UTF-8, an _unset_ value is returned.

> **IMPORTANT:** UTF-8 allows you to combine characters, which are separate code points. While `utf8.substr()` correctly honors the Unicode code point boundaries, however, requesting a substring of several of them may not necessarily represent a meaningful grapheme cluster.
