Repository navigation
Description
Description
In iOS Debug builds, React Native DevTools → Network stores a text response body cut short whenever it contains non-ASCII characters (Arabic, accented Latin, CJK, emoji). Response stops in the middle of the text, and Preview, which can't parse the cut JSON, falls back to numbered plain text instead of the JSON tree. The app itself receives the whole body; only what DevTools stores is cut.
Cause: RCTStringViewFromNSString in Libraries/Network/RCTNetworkConversions.h builds a std::string_view over the UTF-8 bytes but sizes it with NSString.length, which counts UTF-16 units:
inline std::string_view RCTStringViewFromNSString(NSString *string)
{
return std::string_view{string.UTF8String, string.length};
}RCTInspectorNetworkReporter passes every text body through it (maybeStoreResponseBody:data:base64Encoded: and the incremental buffer flushed in reportResponseEnd:encodedDataLength:). So DevTools loses (UTF-8 bytes − UTF-16 units) bytes from the end of each body: 1 per Arabic or accented letter, 2 per CJK character or emoji. Android isn't affected: JInspectorNetworkReporter converts the body with toStdString(), which keeps every byte.
Suggested fix: size the view in UTF-8 bytes:
return std::string_view{string.UTF8String, [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};This is the same root cause as #57061 (reported on 0.85.3 as a SIGABRT and closed for lack of a reproducer). The line is unchanged in 0.88.1 and on main. A reproducer is linked below.
Steps to reproduce
Reproducer: https://github.com/mustafaabobakr/rn-devtools-utf8-body-repro (a plain @react-native-community/cli init app on 0.88.1; only App.tsx and data/ are changed).
yarn install, thencd ios && bundle install && bundle exec pod install && cd ..yarn ios(Debug build, iOS simulator)- In the app, press Fetch ascii.json (control), then Fetch arabic.json. Each fetches a JSON file from the repo over
raw.githubusercontent.com. - Press
jin Metro to open React Native DevTools, then open Network. - Open each request and look at Response and Preview.
| File | UTF-8 bytes | UTF-16 units | Expected in DevTools | Actual in DevTools |
|---|---|---|---|---|
data/ascii.json |
9,028 | 9,028 | whole body, ending in "end": "END_OF_BODY" |
whole body, JSON tree in Preview |
data/arabic.json |
11,328 | 9,128 | whole body, ending in "end": "END_OF_BODY" |
only the first 9,128 bytes; Preview shows plain text |
The app screen shows the byte count it received, to show the app gets the whole body.
I observed and verified this on 0.88.0 in a production app (iPhone 17 simulator, iOS 27.0, prebuilt React.xcframework), where the users/brands response was cut from 6,272 to 6,050 bytes. The reproducer targets 0.88.1, whose header has the same line; I haven't built and run the reproducer itself yet.
React Native Version
0.88.1
Output of npx @react-native-community/cli info
System:
OS: macOS 27.2.1
CPU: (14) arm64 Apple M4 Max
Memory: 174.08 MB / 36.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.22.1
path: /Users/mostafa/.nvm/current/bin/node
Yarn:
version: 1.22.22
path: /Users/mostafa/.nvm/current/bin/yarn
npm:
version: 11.19.1
path: /Users/mostafa/.nvm/current/bin/npm
Watchman:
version: 2026.05.18.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /Users/mostafa/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 27.2
- iOS 27.2
- macOS 27.2
- tvOS 27.2
- visionOS 27.2
- watchOS 27.2
Android SDK:
API Levels:
- "33"
- "34"
- "35"
- "36"
- "37"
Build Tools:
- 30.0.3
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
- 37.0.0
Android NDK: Not Found
IDEs:
Android Studio: 2026.2 AI-262.10968.63.2622.16730706
Xcode:
version: 27.2/27B52
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.19
path: /usr/bin/javac
Ruby:
version: 3.4.6
path: /Users/mostafa/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.88.1
wanted: 0.88.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
(The iOS values read "Not found" / false because pod install hadn't run in the reproducer when this was collected.)
Screenshots and Videos
No screenshots: the screenshots I have come from a production app and show private data. The reproducer shows the same cut body in DevTools → Network → Response.
A workaround that I verified on 0.88.0 is in the first comment.
Activity
mustafaabobakr commentedon Dec 1, 2026
Workaround until this is fixed (Debug only)
Patching
RCTNetworkConversions.hinnode_modulesdoes nothing for most apps, because they link the prebuiltReact.xcframework(the default), which already has the reporter compiled in. So the workaround lives in the app's own native code: one Objective-C++ file that swaps fourRCTInspectorNetworkReporterclass methods at load.base64Encoded:YES. The reporter stores their base64 text, which is ASCII (UTF-16 units == UTF-8 bytes), so the length bug no longer cuts it, and DevTools decodes it back.[DevTools] RCTInspectorNetworkReporter changed; UTF-8 response body fix not installedand leaves React Native unchanged.#if DEBUG, so Release builds contain nothing.How to use it: add
workaround/RCTInspectorNetworkReporter+UTF8Body.mmto your iOS app target (Xcode → drag it into the project, tick every app target), rebuild a Debug build, and reopen DevTools → Network. Delete it onceRCTStringViewFromNSStringsizes the view in UTF-8 bytes.Verified on 0.88.0 (iPhone 17 simulator, iOS 27.0, prebuilt
React.xcframework), reading bodies back over CDPNetwork.getResponseBody:Content-Length;Limits: base64 makes a stored body about a third larger, so the largest single body DevTools keeps drops from about 100 MB to about 75 MB (the reporter's buffer is
REQUEST_BUFFER_MAX_SIZE_BYTES, 100 MB). It relies on four method names ofRCTInspectorNetworkReporter, so recheck it on every upgrade (the log line above tells you).RCTInspectorNetworkReporter+UTF8Body.mmgabrieldonadel commentedon Dec 1, 2026
Fixed on
mainby #60322 (fa1dc61).RCTStringViewFromNSStringnow measures the view in UTF-8 bytes (lengthOfBytesUsingEncoding:NSUTF8StringEncoding), not UTF-16 units, so DevTools gets the whole text body. This also covers the crash in #57061.Thanks for the detailed report and reproducer! Until the fix is picked to a stable release, the workaround above still applies.