Skip to content

Fix CoreAudio device UID encoding: use kCFStringEncodingUTF8 #1018

Open
zinc75 wants to merge 1 commit intojackaudio:developfrom
zinc75:fix/coreaudio-uid-utf8-encoding
Open

Fix CoreAudio device UID encoding: use kCFStringEncodingUTF8 #1018
zinc75 wants to merge 1 commit intojackaudio:developfrom
zinc75:fix/coreaudio-uid-utf8-encoding

Conversation

@zinc75
Copy link
Copy Markdown

@zinc75 zinc75 commented Apr 11, 2026

Fixes #1017

Change

In DisplayDeviceNames(), macosx/coreaudio/JackCoreAudioDriver.mm line 228:

// Before:
CFStringGetCString(UIname, internal_name, 256, CFStringGetSystemEncoding());
// After:
CFStringGetCString(UIname, internal_name, 256, kCFStringEncodingUTF8);

Rationale

CFStringGetSystemEncoding() returns kCFStringEncodingMacRoman on most
macOS systems. CoreAudio device UIDs are UTF-8 strings. When a UID contains
non-ASCII characters (e.g. RØDE AI-Micro — Ø = U+00D8, UTF-8 0xC3 0x98),
the bytes are misinterpreted as two separate MacRoman characters, producing
a corrupted internal name that no longer matches what the caller passes via
-C, -P or -d. Jack then silently falls back to the default device.

kCFStringEncodingUTF8 is what CoreAudio uses natively for device UIDs,
so this is the correct encoding to use here.

Testing

The diagnosis is based on source code analysis and the solution has been validated indirectly: a workaround in
JackMate that re-injects the raw
MacRoman bytes extracted from jackd -d coreaudio -l confirms that the
encoding mismatch is the sole cause of the issue. See #1017
for full reproduction steps.

@zinc75
Copy link
Copy Markdown
Author

zinc75 commented Apr 24, 2026

@falkTX : gently reminder : did you have time to look at my PR and the linked issue ?

Best regards,

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.

[coreaudio] Device UIDs with non-ASCII characters are corrupted — CFStringGetSystemEncoding() should be kCFStringEncodingUTF8

1 participant