From 1fb3ce7ac015d55272a544ea717e9270ae0d7dd0 Mon Sep 17 00:00:00 2001 From: cliffamzn Date: Mon, 27 Feb 2023 17:03:26 -0800 Subject: [PATCH] Fix encoding for device name We should be using UTF8 encoding rather than ASCII encoding --- .../MatterTvCastingBridge/ConversionUtils.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm index 3f98f96d2286c3..74f41c5203d022 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm @@ -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. @@ -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) { @@ -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++) {