iOS: Change image source url encode ascii to utf8 (#43502)

Summary:
We should use utf8 to cover more characters.

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Change image source url encode ascii to utf8

Pull Request resolved: https://github.com/facebook/react-native/pull/43502

Test Plan: Fixes https://github.com/facebook/react-native/issues/43462

Reviewed By: rshest

Differential Revision: D54944653

Pulled By: cortinico

fbshipit-source-id: 0bbd3d46c8e5c04ceffe7e0ebae46dc2ce9507df
This commit is contained in:
zhongwuzw
2024-03-18 10:27:57 +00:00
committed by Alex Hunt
parent 8830ed6bba
commit aa0670b0ae
@@ -48,10 +48,10 @@ inline static NSURL *NSURLFromImageSource(const facebook::react::ImageSource &im
{
// `NSURL` has a history of crashing with bad input, so let's be safe.
@try {
NSString *urlString = [NSString stringWithCString:imageSource.uri.c_str() encoding:NSASCIIStringEncoding];
NSString *urlString = [NSString stringWithUTF8String:imageSource.uri.c_str()];
if (!imageSource.bundle.empty()) {
NSString *bundle = [NSString stringWithCString:imageSource.bundle.c_str() encoding:NSASCIIStringEncoding];
NSString *bundle = [NSString stringWithUTF8String:imageSource.bundle.c_str()];
urlString = [NSString stringWithFormat:@"%@.bundle/%@", bundle, urlString];
}