Merge pull request #13498 from lipka/utf8

Objective-C: UTF8 encoding for error messages and metadata values
pull/15413/head
Muxi Yan 7 years ago committed by GitHub
commit fd30b02486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/objective-c/GRPCClient/private/NSDictionary+GRPC.m
  2. 2
      src/objective-c/GRPCClient/private/NSError+GRPC.m

@ -54,7 +54,7 @@
+ (instancetype)grpc_stringFromMetadataValue:(grpc_metadata *)metadata {
return [[self alloc] initWithBytes:GRPC_SLICE_START_PTR(metadata->value)
length:GRPC_SLICE_LENGTH(metadata->value)
encoding:NSASCIIStringEncoding];
encoding:NSUTF8StringEncoding];
}
// Precondition: This object contains only ASCII characters.

@ -27,7 +27,7 @@ NSString *const kGRPCErrorDomain = @"io.grpc";
if (statusCode == GRPC_STATUS_OK) {
return nil;
}
NSString *message = [NSString stringWithCString:details encoding:NSASCIIStringEncoding];
NSString *message = [NSString stringWithCString:details encoding:NSUTF8StringEncoding];
return [NSError errorWithDomain:kGRPCErrorDomain
code:statusCode
userInfo:@{NSLocalizedDescriptionKey : message}];

Loading…
Cancel
Save