From 25463aa5fc3592c83026fc21de5305b08c7459b2 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 24 Jun 2025 10:31:50 +0200 Subject: [PATCH] CoreFoundation: selectable charset on cfstring creation Signed-off-by: Simon Rozman --- include/MacStd/CoreFoundation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/MacStd/CoreFoundation.hpp b/include/MacStd/CoreFoundation.hpp index c51737e..fa509c2 100644 --- a/include/MacStd/CoreFoundation.hpp +++ b/include/MacStd/CoreFoundation.hpp @@ -82,14 +82,14 @@ namespace macstd { public: cfstring(CFStringRef h) : cfobject(h) {} - cfstring(const char *s) : cfobject(CFStringCreateWithCString(kCFAllocatorDefault, s, kCFStringEncodingUTF8)) + cfstring(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8) : cfobject(CFStringCreateWithCString(kCFAllocatorDefault, s, encoding)) { if (!valid()) [[unlikely]] throw std::bad_alloc(); } template - cfstring(const std::basic_string &s) : cfstring(s.c_str()) {} + cfstring(const std::basic_string &s, CFStringEncoding encoding = kCFStringEncodingUTF8) : cfstring(s.c_str(), encoding) {} }; ///