Skip to content

Commit

Permalink
Fix encoding for device name
Browse files Browse the repository at this point in the history
We should be using UTF8 encoding rather than ASCII encoding
  • Loading branch information
cliffamzn authored and sharadb-amazon committed Mar 3, 2023
1 parent 0573c94 commit f62853e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright (c) 2020-2022 Project CHIP Authors
* Copyright (c) 2020-2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -120,16 +120,16 @@ + (DiscoveredNodeData *)convertToObjCDiscoveredNodeDataFrom:(const chip::Dnssd::
objCDiscoveredNodeData.commissioningMode = cppDiscoveredNodedata->commissionData.commissioningMode;
objCDiscoveredNodeData.pairingHint = cppDiscoveredNodedata->commissionData.pairingHint;
objCDiscoveredNodeData.deviceName = [NSString stringWithCString:cppDiscoveredNodedata->commissionData.deviceName
encoding:NSASCIIStringEncoding];
encoding:NSUTF8StringEncoding];
objCDiscoveredNodeData.rotatingIdLen = cppDiscoveredNodedata->commissionData.rotatingIdLen;
objCDiscoveredNodeData.rotatingId = cppDiscoveredNodedata->commissionData.rotatingId;
objCDiscoveredNodeData.instanceName = [NSString stringWithCString:cppDiscoveredNodedata->commissionData.instanceName
encoding:NSASCIIStringEncoding];
encoding:NSUTF8StringEncoding];

// from CommonResolutionData
objCDiscoveredNodeData.port = cppDiscoveredNodedata->resolutionData.port;
objCDiscoveredNodeData.hostName = [NSString stringWithCString:cppDiscoveredNodedata->resolutionData.hostName
encoding:NSASCIIStringEncoding];
encoding:NSUTF8StringEncoding];
objCDiscoveredNodeData.platformInterface = cppDiscoveredNodedata->resolutionData.interfaceId.GetPlatformInterface();
objCDiscoveredNodeData.numIPs = cppDiscoveredNodedata->resolutionData.numIPs;
if (cppDiscoveredNodedata->resolutionData.numIPs > 0) {
Expand All @@ -154,7 +154,7 @@ + (VideoPlayer *)convertToObjCVideoPlayerFrom:(TargetVideoPlayerInfo * _Nonnull)
objCVideoPlayer.deviceType = cppTargetVideoPlayerInfo->GetDeviceType();
objCVideoPlayer.isConnected = (cppTargetVideoPlayerInfo->GetOperationalDeviceProxy() != nil);
objCVideoPlayer.deviceName = [NSString stringWithCString:cppTargetVideoPlayerInfo->GetDeviceName()
encoding:NSASCIIStringEncoding];
encoding:NSUTF8StringEncoding];
objCVideoPlayer.contentApps = [NSMutableArray new];
TargetEndpointInfo * cppTargetEndpointInfos = cppTargetVideoPlayerInfo->GetEndpoints();
for (size_t i = 0; i < kMaxNumberOfEndpoints && cppTargetEndpointInfos[i].IsInitialized(); i++) {
Expand Down

0 comments on commit f62853e

Please sign in to comment.