We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22b220c commit cb63ee1Copy full SHA for cb63ee1
src/server/messages.d
@@ -209,11 +209,16 @@ class UMessage
209
static if (is(T : string)) {
210
if (size > 0) {
211
const(ubyte)[] bytes = in_buf[offset .. offset + size];
212
- value = cast(T) bytes.idup; // UTF-8
213
offset += size;
214
215
try {
216
- value.validate;
+ @trusted
+ static string decode_utf8(const(ubyte)[] bytes) {
217
+ const value = cast(string) bytes;
218
+ value.validate();
219
+ return value;
220
+ }
221
+ value = decode_utf8(bytes);
222
}
223
catch (UTFException) {
224
// Latin-1 fallback
0 commit comments