Skip to content

Fix OmniVoice instruct splitting for UTF-8 separators - #1146

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
supomarlo:main
Oct 30, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
supomarlo:main

Conversation

@supomarlo

Copy link
Copy Markdown
Contributor

Summary

resolve_instruct() rejects the valid 东北话 instruct tag because the
separator regex splits the UTF-8 character 北 in the middle.

The fix changes the separator from a byte character class to an explicit
byte-sequence alternation.

Root cause

std::regex is basic_regex<char> and matches UTF-8 bytes, not Unicode code
points. The full-width comma , is EF BC 8C; inside a character class it
becomes three independent byte alternatives. 北 is E5 8C 97, so its 8C
byte matches the separator and splits 东北话 into two invalid fragments.

The server then returns HTTP 500:

{
  "error": {
    "message": "unsupported OmniVoice instruct items: '东�' (unsupported), '�话' (unsupported)",
    "type": "server_error"
  }
}

Fix

-    std::regex separator(R"(\s*[,,]\s*)");
+    std::regex separator(R"(\s*(?:,|\xEF\xBC\x8C)\s*)");

\xEF\xBC\x8C is one consecutive three-byte sequence, so it cannot match the
8C byte inside 北.

Verification

Minimal regex reproduction, original vs fixed:

input original fixed
东北话 东� / �话 东北话
female, young adult, low pitch, 东北话 5 parts, tag split 4 parts, 东北话 intact
female,东北话 3 parts, tag split 2 parts, 东北话 intact

Direct server test via POST /v1/audio/speech with omnivoice_q8_0
(Windows x64, MSVC 19.44, Vulkan portable build) before the fix:

case result
Other 11 dialect tags 200
东北话 500
female, young adult, low pitch, 四川话 200
female, young adult, low pitch, 东北话 500

After applying only the regex change and rebuilding the same Vulkan portable
configuration:

case result
东北话 200
female, young adult, low pitch, 东北话 200
female,东北话 200

Scope

  • Fixes only the full-width comma byte collision that splits 东北话.
  • All other instruct parsing and validation logic is unchanged.

std::regex<char> treats each byte of the full-width comma (EF BC 8C) as a separate character-class member. The 8C byte also occurs in 北, so tags such as 东北话 are split mid-codepoint and rejected. Match the comma as a consecutive byte sequence instead.
@0xShug0
0xShug0 merged commit 828cf16 into 0xShug0:main Oct 30, 2026
6 of 8 checks passed
@0xShug0

0xShug0 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

@supomarlo Thanks! PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants