Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Android Capacitor Returns UTF-8 Binary String Instead of Blob for Binary Responses #7944

Open
1 of 3 tasks
layola13 opened this issue Mar 26, 2025 · 2 comments
Open
1 of 3 tasks
Labels
needs reproduction needs reproducible example to illustrate the issue

Comments

@layola13
Copy link

Capacitor Version

Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 7.1.0
@capacitor/core: 7.1.0
@capacitor/android:
7.1.0
@capacitor/ios: 7.1.0

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 7.1.0
@capacitor/core: 7.1.0
@capacitor/android: 7.1.0

[success] Android looking great! 👌

Other API Details

npm -v 10.9.2

 node -v v23.9.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

When making network requests with responseType: 'blob' on Android with Capacitor, instead of receiving a proper Blob object like on web platforms, the response is a UTF-8 encoded binary string. This inconsistency causes issues when trying to handle binary data like audio files across different platforms.

  • On web: response.data is a proper Blob object

Image

  • On Android: response.data is a UTF-8 encoded binary string

Image

Expected Behavior

When making a request with responseType: 'blob', the response should be a standard Blob object on all platforms (web and Android), allowing consistent code handling.

Project Reproduction

https://gist.github.com/layola13/55bd89421c9e82d066d584b80f0da551

Additional Information

This inconsistency makes it difficult to handle binary responses in a cross-platform manner. Ideally, Capacitor should normalize the response type to be consistent with web behavior, returning a proper Blob object when responseType: 'blob' is specified.

@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Mar 26, 2025
Copy link

ionitron-bot bot commented Mar 26, 2025

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed.
Please see the Contributing Guide for how to create a Sample App.
Thanks! Ionitron 💙

@ionitron-bot ionitron-bot bot removed the triage label Mar 26, 2025
@Ionitron Ionitron added needs reply needs reply from the user and removed needs reply needs reply from the user labels Mar 26, 2025
@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Mar 26, 2025
@layola13
Copy link
Author

layola13 commented Mar 29, 2025

https://github.com/layola13/capacitor-blob-bug-reproduction
@jcesarmobile

web

test1 ❌
test2 ✅
test3 ✅
test4 ❌
test5 ✅ //from https server

andoird

test1 ❌
test2 ✅
test3 ✅
test4 ❌
test5 ❌//from https server

@Ionitron Ionitron removed the needs reply needs reply from the user label Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction needs reproducible example to illustrate the issue
Projects
None yet
Development

No branches or pull requests

3 participants