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

Unexpected char in header #573

Open
Drazail opened this issue Mar 30, 2020 · 9 comments · Fixed by RonRadtke/react-native-blob-util#112
Open

Unexpected char in header #573

Drazail opened this issue Mar 30, 2020 · 9 comments · Fixed by RonRadtke/react-native-blob-util#112

Comments

@Drazail
Copy link

Drazail commented Mar 30, 2020

Environment

library version: 0.11.2
react: 16.13.0
react-native: 0.61.5
OS: Android

Description

there is this strange problem we are facing while trying to make a post request on android:

the header key we pass to the JS API is:

'X-MOBILE-APP-VERSION'

however on the native side RNFetchBlob tries to set the header as:

x-mobıle-app-versıonnull

this issue happens only when device's language is set to Turkish and the header is in caps. ( presumably ,depending on the header, other non ASCII languages should face the same problem)

Speculation

seems to be originating from .toLowerCase() in RNFetchBlobReq.java

StackTrace:

Error RNFetchBlob request error: Unexpected char 0x131 at 5 in header name: x-mobıle-app-versıonnull node_modules/rn-fetch-blob/index.js:307:25 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:483:12 value node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:28 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:8 value node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:17 value [native code] value

CodeSample

          const response = await RNFetchBlob
            .config({ timeout: 4000 })
            .fetch('POST', `${URL}`, {
              'Content-Type': 'application/json',
              Accept: 'application/json',
              'X-MOBILE-APP-VERSION': Config.APP_VERSION,
              'X-MOBILE-APP-MARKET': Config.APP_MARKET,
              'User-Agent': await userAgent,
              Authorization: getToken(),
            }, [
              {
                name: 'id', data: id,
              },
            ]);
the following lines seems to be the problem:
 'X-MOBILE-APP-VERSION': Config.APP_VERSION,
 'X-MOBILE-APP-MARKET': Config.APP_MARKET,
@ObidosDev
Copy link

Same problem. Good explanation. My user has TR locale and got exact the same error

@ulrellik
Copy link

ulrellik commented Jun 7, 2021

Same here, the 'i' causes problems with another header, but the problem is the same:
RNFetchBlob request error: Unexpected char 0x131 at 0 in header name: ıf-modified-sincenull
The guy has Android Galaxy A71 with Turkish locale and the app sets the header like this: 'If-Modified-Since' so the capital first 'I' has issues.

@eczmustafa
Copy link

same problem with Joplin app.

eczmustafa added a commit to eczmustafa/rn-fetch-blob that referenced this issue Jan 25, 2022
a temporary workaround about the issue joltup#573
@eczmustafa
Copy link

this project seems to be unmaintained but i made a pull request anyway: #762

eczmustafa added a commit to eczmustafa/rn-fetch-blob that referenced this issue Jan 25, 2022
.toLowerCase() function on an Android system with Turkish language causes a bug.

Please see: joltup#573

Error message starts with "Error RNFetchBlob request error: Unexpected char 0x131 at ...". -> 0x131 is ı (dotless i).

.toLowerCase() function works and does its job in a correct way. However, dotless i and normal i aren't considered equal, naturally.

Only workaround, as far as i can find out, is this.
halaei added a commit to halaei/Detox that referenced this issue Feb 2, 2022
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for `toLowerCase()` and `toUppercase()` in my project's dependencies and send the same PR, in order to potentially raise the awareness. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if wix/Detox is actually affected. 

Example related issue: joltup/rn-fetch-blob#573
halaei added a commit to halaei/react-native-share that referenced this issue Feb 2, 2022
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to potentially raise the awareness. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native-share is actually affected.

Example related issue: joltup/rn-fetch-blob#573
mikehardy pushed a commit to react-native-share/react-native-share that referenced this issue Feb 2, 2022
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to potentially raise the awareness. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native-share is actually affected.

Example related issue: joltup/rn-fetch-blob#573
MateusAndrade pushed a commit to react-native-share/react-native-share that referenced this issue Feb 2, 2022
## [7.3.5](v7.3.4...v7.3.5) (2022-02-02)

### Bug Fixes

* **android:** use Locale.ROOT when changing case in java ([#1152](#1152)) ([afd908c](afd908c)), closes [joltup/rn-fetch-blob#573](joltup/rn-fetch-blob#573)
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Feb 9, 2022
Summary:
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to just be considered. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native is actually affected. I haven't checked for `String.format()` yet.

Example related issue: joltup/rn-fetch-blob#573

## Changelog

[Android] [Fixed] - Use root locale when converting string case.

Pull Request resolved: #33028

Reviewed By: ShikaSD

Differential Revision: D33943446

Pulled By: cortinico

fbshipit-source-id: d5be9392ea7c21a33436acac5b5e8c50b7c7e31e
jonathanmos pushed a commit to wix/Detox that referenced this issue Feb 13, 2022
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for `toLowerCase()` and `toUppercase()` in my project's dependencies and send the same PR, in order to potentially raise the awareness. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if wix/Detox is actually affected. 

Example related issue: joltup/rn-fetch-blob#573
@Moon1moon
Copy link

same problem with Joplin app.

Telefonun dilini(uygulamanın değil) bir kereliğine ingilizceye alıp senkronizasyon yapınca sorun çözülüyor. Sonra türkçe yapabilirsiniz. 😬

@eczmustafa
Copy link

şimdi denedim. ilk sefer de problem çözülmüş gibi göründü. fakat yeni not ekleyince aynı hatayı verdi:
Unexpected char 0x131 at 0 in header name: ıf-none-matchnull
heralde microsoft veya google'dan birine teslim olmak zorundayız :(

@Moon1moon
Copy link

şimdi denedim. ilk sefer de problem çözülmüş gibi göründü. fakat yeni not ekleyince aynı hatayı verdi: Unexpected char 0x131 at 0 in header name: ıf-none-matchnull heralde microsoft veya google'dan birine teslim olmak zorundayız :(

Şifre ekleyince ya da şifreyi değiştirince yeniden ilk sefer için telefonun dilini ingilizceye çevirip bir kere daha senkronize etmek gerekiyor

1 similar comment
@Moon1moon
Copy link

şimdi denedim. ilk sefer de problem çözülmüş gibi göründü. fakat yeni not ekleyince aynı hatayı verdi: Unexpected char 0x131 at 0 in header name: ıf-none-matchnull heralde microsoft veya google'dan birine teslim olmak zorundayız :(

Şifre ekleyince ya da şifreyi değiştirince yeniden ilk sefer için telefonun dilini ingilizceye çevirip bir kere daha senkronize etmek gerekiyor

@halaei
Copy link

halaei commented Feb 25, 2022

I don't understand Turkish but this issue was fixed in this fork: https://github.com/RonRadtke/react-native-blob-util

eczmustafa added a commit to eczmustafa/rn-fetch-blob that referenced this issue Jul 10, 2022
mobiledev7 added a commit to mobiledev7/react-native-share that referenced this issue Dec 12, 2022
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to potentially raise the awareness. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native-share is actually affected.

Example related issue: joltup/rn-fetch-blob#573
mobiledev7 added a commit to mobiledev7/react-native-share that referenced this issue Dec 12, 2022
shwanton pushed a commit to shwanton/react-native-macos that referenced this issue Feb 13, 2023
Summary:
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to just be considered. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native is actually affected. I haven't checked for `String.format()` yet.

Example related issue: joltup/rn-fetch-blob#573

## Changelog

[Android] [Fixed] - Use root locale when converting string case.

Pull Request resolved: facebook#33028

Reviewed By: ShikaSD

Differential Revision: D33943446

Pulled By: cortinico

fbshipit-source-id: d5be9392ea7c21a33436acac5b5e8c50b7c7e31e
renovate bot added a commit to valora-inc/wallet that referenced this issue Oct 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-share](https://react-native-share.github.io/react-native-share/)
([source](https://togithub.com/react-native-community/react-native-share))
| [`^7.3.2` ->
`^7.9.1`](https://renovatebot.com/diffs/npm/react-native-share/7.3.2/7.9.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-share/7.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-share/7.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-share/7.3.2/7.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-share/7.3.2/7.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>react-native-community/react-native-share
(react-native-share)</summary>

###
[`v7.9.1`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.9.1)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.9.0...v7.9.1)

##### Bug Fixes

- **android:** show extra dialog on Android, when users share a video to
instagram
([#&#8203;1277](https://togithub.com/react-native-community/react-native-share/issues/1277))
([acd283e](https://togithub.com/react-native-community/react-native-share/commit/acd283e9a9a0a6732b6fa1362a27b757b15441b3))

###
[`v7.9.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.9.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.8.0...v7.9.0)

##### Features

- **ios:** Share a link for Messenger on iOS
([#&#8203;1268](https://togithub.com/react-native-community/react-native-share/issues/1268))
([91be736](https://togithub.com/react-native-community/react-native-share/commit/91be7369e08cb3f5094ae42e1d8605dc1fd7528a))

###
[`v7.8.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.8.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.7.1...v7.8.0)

##### Features

- **ios:** support added for instagram direct message
([#&#8203;1255](https://togithub.com/react-native-community/react-native-share/issues/1255))
([146126b](https://togithub.com/react-native-community/react-native-share/commit/146126b6fef2bf8357ed5fbe319171216c4e1a97))

###
[`v7.7.1`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.7.1)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.7.0...v7.7.1)

##### Bug Fixes

- **ios:** successCallback usages
([#&#8203;1257](https://togithub.com/react-native-community/react-native-share/issues/1257))
([d3cfaef](https://togithub.com/react-native-community/react-native-share/commit/d3cfaefaf356b7fa99b142cde53e9f509ec859dd))

###
[`v7.7.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.7.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.6...v7.7.0)

##### Features

- **windows:** support the new c++ react native for windows implement…
([#&#8203;1254](https://togithub.com/react-native-community/react-native-share/issues/1254))
([c64f78d](https://togithub.com/react-native-community/react-native-share/commit/c64f78dfb8fc65d5c7ca5e33a5bbca6fc6107914))

###
[`v7.6.6`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.6)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.5...v7.6.6)

##### Bug Fixes

- **android:** add background type for instagram video story sharing
([#&#8203;1248](https://togithub.com/react-native-community/react-native-share/issues/1248))
([3d9312b](https://togithub.com/react-native-community/react-native-share/commit/3d9312bbde17326dd787b4947b308964beb2b1e2))

###
[`v7.6.5`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.5)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.4...v7.6.5)

##### Bug Fixes

- **release:** force
[#&#8203;1242](https://togithub.com/react-native-community/react-native-share/issues/1242)
release
([40d7bd4](https://togithub.com/react-native-community/react-native-share/commit/40d7bd430603388533b05d9a6d7814e9add622bc))

###
[`v7.6.4`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.4)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.3...v7.6.4)

##### Bug Fixes

- **android:** facebook stories
([#&#8203;1231](https://togithub.com/react-native-community/react-native-share/issues/1231))
([8fcf8c2](https://togithub.com/react-native-community/react-native-share/commit/8fcf8c21dbc6d58ce8fc8dc256571ae498d3c1ab))

###
[`v7.6.3`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.3)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.2...v7.6.3)

##### Bug Fixes

- **typing:** remove "method" typing
([#&#8203;1227](https://togithub.com/react-native-community/react-native-share/issues/1227))
([a5b2710](https://togithub.com/react-native-community/react-native-share/commit/a5b27107c4e357f3b62199a3d63e2555af6d2ca9))

###
[`v7.6.2`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.2)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.1...v7.6.2)

##### Bug Fixes

- **test:** validating semantic-release update
([d37af55](https://togithub.com/react-native-community/react-native-share/commit/d37af55d3b76139371e050befeb5eb8acebf6d96))

###
[`v7.6.1`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.1)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.6.0...v7.6.1)

##### Bug Fixes

- **ios:** use https in place of https for facebook/instagram/whatsapp
([#&#8203;1215](https://togithub.com/react-native-community/react-native-share/issues/1215))
([3d60abc](https://togithub.com/react-native-community/react-native-share/commit/3d60abc5c0a5ab81a8d0ddda11b7b27a38f84d6a))

###
[`v7.6.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.6.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.5.0...v7.6.0)

##### Features

- singleShare supports for Viber
([#&#8203;1213](https://togithub.com/react-native-community/react-native-share/issues/1213))
([c8e6219](https://togithub.com/react-native-community/react-native-share/commit/c8e621953f2264476cae8d178eadcc110616d2c0))

###
[`v7.5.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.5.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.4.1...v7.5.0)

##### Features

- singleShare supports urls for email
([#&#8203;1204](https://togithub.com/react-native-community/react-native-share/issues/1204))
([7910eea](https://togithub.com/react-native-community/react-native-share/commit/7910eea500ae3eb54e5b760abdf0f00323242e30))

###
[`v7.4.1`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.4.1)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.4.0...v7.4.1)

##### Bug Fixes

- **ios:** remove old style double-quote imports
([#&#8203;1198](https://togithub.com/react-native-community/react-native-share/issues/1198))
([96e93ce](https://togithub.com/react-native-community/react-native-share/commit/96e93ce487a51b60391b8de7551ec11655e6ebbe))

###
[`v7.4.0`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.4.0)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.9...v7.4.0)

##### Features

- **task:** share with new task android
([#&#8203;1195](https://togithub.com/react-native-community/react-native-share/issues/1195))
([7ace66e](https://togithub.com/react-native-community/react-native-share/commit/7ace66edf1cd6c3fb358d3fce8f9681536c7cd8e))

###
[`v7.3.9`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.9)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.8...v7.3.9)

##### Bug Fixes

- **ios:** Replace initWithURLs with initForExportingURLs on iOS 15+
([#&#8203;1181](https://togithub.com/react-native-community/react-native-share/issues/1181))
([bf0a51e](https://togithub.com/react-native-community/react-native-share/commit/bf0a51eb8696ef34ee4012d492ea472d29a18c8a))

###
[`v7.3.8`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.8)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.7...v7.3.8)

##### Bug Fixes

- **ios:** custom title got over written by meta data
([#&#8203;1184](https://togithub.com/react-native-community/react-native-share/issues/1184))
([54a80d0](https://togithub.com/react-native-community/react-native-share/commit/54a80d0c259657389e1b593cffc5262fe0b0e4b8))

###
[`v7.3.7`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.7)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.6...v7.3.7)

##### Bug Fixes

- whatsapp single share
([#&#8203;1171](https://togithub.com/react-native-community/react-native-share/issues/1171))
([a57639a](https://togithub.com/react-native-community/react-native-share/commit/a57639a042fe81d998cb7f12024fd61136a1b1b9))

###
[`v7.3.6`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.6)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.5...v7.3.6)

##### Bug Fixes

- Add mime type when using sticker image
([#&#8203;1140](https://togithub.com/react-native-community/react-native-share/issues/1140))
([9389d2d](https://togithub.com/react-native-community/react-native-share/commit/9389d2d263b700d9e824aed9ae2a2d1bf8f3632c))

###
[`v7.3.5`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.5)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.4...v7.3.5)

##### Bug Fixes

- **android:** use Locale.ROOT when changing case in java
([#&#8203;1152](https://togithub.com/react-native-community/react-native-share/issues/1152))
([afd908c](https://togithub.com/react-native-community/react-native-share/commit/afd908c30d97cfb7b61712eda489a40775cf9044)),
closes
[joltup/rn-fetch-blob#573](https://togithub.com/joltup/rn-fetch-blob/issues/573)

###
[`v7.3.4`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.4)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.3...v7.3.4)

##### Bug Fixes

- support unknown whatsapp number
([4a56221](https://togithub.com/react-native-community/react-native-share/commit/4a56221c96383f8175e59e41844aecafae37fe90))

###
[`v7.3.3`](https://togithub.com/react-native-share/react-native-share/releases/tag/v7.3.3)

[Compare
Source](https://togithub.com/react-native-community/react-native-share/compare/v7.3.2...v7.3.3)

##### Bug Fixes

- **android:** instagram stories added image/jpeg
([#&#8203;1137](https://togithub.com/react-native-community/react-native-share/issues/1137))
([880b00d](https://togithub.com/react-native-community/react-native-share/commit/880b00da35b462a439f51df79dce1e9af59bca60)),
closes
[/github.com/react-native-share/react-native-share/issues/1084#issuecomment-932348328](https://togithub.com//github.com/react-native-share/react-native-share/issues/1084/issues/issuecomment-932348328)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOS4yIiwidXBkYXRlZEluVmVyIjoiMzcuMTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
Co-authored-by: Jean Regisser <jean.regisser@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants