Repository: yt-dlp
Issue: The byte string format goes over the specified byte value if it's in a middle of a multi-byte utf-8 codepoint
Labels: bug,core-triage

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

I want to limit the filename to be at most 68 bytes. The byte string format should supposedly help me with that, by specifying `-o '%(title).68B'`. Yet, the filename I get is 70 bytes.

```bash
$ yt-dlp --simulate -o '%(title).68B' --print filename https://www.youtube.com/watch?v=m9D15U6tBG8
踊 - Ado ⧸ covered by キズナアイ（ブラックアイ）【歌
$ echo -n '踊 - Ado ⧸ covered by キズナアイ（ブラックアイ）【歌' | wc -c
70
$ yt-dlp --simulate -o '%(title).68B' --print filename https://www.youtube.com/watch?v=m9D15U6tBG8 | tr -d '\n' | wc -c
70
```

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '--no-config', '--simulate', '-o', '%(title).68B', '--print', 'filename', 'https://www.youtube.com/watch?v=m9D15U6tBG8']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.05.27 from yt-dlp/yt-dlp [12b248ce6] (pip)
[debug] Python 3.9.2 (CPython x86_64 64bit) - Linux-5.10.0-26-amd64-x86_64-with-glibc2.31 (OpenSSL 1.1.1w  11 Sep 2023, glibc 2.31)
[debug] exe versions: ffmpeg 4.3.6-0, ffprobe 4.3.6-0, phantomjs broken
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, requests-2.31.0, sqlite3-3.34.1, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1820 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.05.27 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.05.27 from yt-dlp/yt-dlp)
[youtube] Extracting URL: https://www.youtube.com/watch?v=m9D15U6tBG8
[youtube] m9D15U6tBG8: Downloading webpage
[youtube] m9D15U6tBG8: Downloading ios player API JSON
[debug] [youtube] Extracting signature function js_bc657243_100
[youtube] m9D15U6tBG8: Downloading player bc657243
[debug] Saving youtube-sigfuncs.js_bc657243_100 to cache
[debug] Loading youtube-nsig.bc657243 from cache
[debug] [youtube] Decrypted nsig hv3wzOlkm_fcEJi39 => e9aHlq7Rb5og-Q
[debug] [youtube] Extracting signature function js_bc657243_104
[debug] Loading youtube-sigfuncs.js_bc657243_104 from cache
[debug] Loading youtube-nsig.bc657243 from cache
[debug] [youtube] Decrypted nsig n-KNdAtGjF15rF735 => 1ZXeYgsNR1wlPQ
[youtube] m9D15U6tBG8: Downloading m3u8 information
[debug] [youtube] Invalid start time (1140.0 > 209) for chapter "日程： 2021年6月30日(水)　開場 18:00 / 開演"
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] m9D15U6tBG8: Downloading 1 format(s): 616+251
踊 - Ado ⧸ covered by キズナアイ（ブラックアイ）【歌
```