matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

[React Native] Unterminated string constant in unhomoglyph/data.json

Open annie-elequin opened this issue 6 years ago • 6 comments

image

I get this error when using matrix-js-sdk with React Native Expo and I try to publish the project. (I can run the project in Simulator without publishing)

Expected behavior

Expo should successfully publish the app to the user's account.

To Reproduce

  1. Create a new Expo project with expo init.
  2. yarn add matrix-js-sdk.
  3. Follow steps in this article to get matrix-js-sdk working.
  4. Start package manager with expo start and in another terminal, run expo publish.

Environment

MacOS 10.14.5 iOS Simulator XR 12.1 Node 10.16.0 Expo CLI 2.21.1 (SDK 33) Matrix JS SDK 2.0.1

Other Notes

I tried removing line 159 (the original error line) from unhomoglyph/data.json, which didn't work, and subsequently removed every line after that - it ended up just changing the error line to the last line in the file (154 in the screenshot).

annie-elequin avatar Jun 28 '19 19:06 annie-elequin

Perhaps you should open this issue under the unhomoglyph project

t3chguy avatar Jun 28 '19 20:06 t3chguy

Fair - I'll do that. I came here because matrix-js-sdk is the one that's using unhomoglyph so I was hoping there would be some insight or other people who have had this problem, but I'll take the issue over there -> https://github.com/nodeca/unhomoglyph/issues/2

annie-elequin avatar Jun 28 '19 20:06 annie-elequin

As @t3chguy says, it seems like an upstream issue. If unhomoglyph makes a change to fix it, we could use this issue to track updating the dependency.

jryans avatar Jul 01 '19 09:07 jryans

They immediately closed the issue, so it might be with expo having broken Unicode handling instead, the file ~looks like~ is valid JSON, according to https://codebeautify.org/jsonvalidator

t3chguy avatar Jul 01 '19 09:07 t3chguy

@t3chguy As an update (sorry, haven't been able to work on this much), this happens when bundling with React Native (no expo) too - so at least that kinda narrows it down to the metro bundler.

The Unicode handling is a good thought, are there any workarounds for that type of problem?

annie-elequin avatar Jul 26 '19 17:07 annie-elequin

oh @t3chguy update -

I converted the data.json file to ascii and used that in the unhomoglyph library instead of the original. (converted using https://onlineutf8tools.com/convert-utf8-to-ascii)

This let me bundle the app with metro bundler! I don't know how this affects matrix-js-sdk though, but it feels like progress to me.

annie-elequin avatar Jul 26 '19 17:07 annie-elequin