Comments (9)
Setting fatal=true
will cause the polyfill to fail since it's not supported.
I could probably add support, it wouldn't be too hard.
from fast-text-encoding.
But it seems the fatal
option is not used at all in the library
fatal
is always set to false
here https://github.com/samthor/fast-text-encoding/blob/master/src/o-decoder.js#L51
But the validation above it rejects the fatal
option. https://github.com/samthor/fast-text-encoding/blob/master/src/o-decoder.js#L35
So wondering why you need the validation when you do not use it at all?
FYI, I am currently use your library to polyfill encoder/decoder in React Native and some other libraries do use the fatal
option. I made a simple patch to disable only the validation (leaving this.fatal=false
unchanged) and it seems to be working fine.
However I am not sure your library will work 100% ok for that change. So it would be nice if I have your confirmation or if you have time, you can make a change to the library if possible and necessary.
from fast-text-encoding.
Setting fatal=true will cause the polyfill to fail since it's not supported.
I could probably add support, it wouldn't be too hard.
That'd be awesome if you could add support for fatal
. Otherwise please provide some guidance and I'll help implement it. Thanks!
from fast-text-encoding.
@pablodenadai @samthor @khoanguyen-yang I'm also encountering this issue when integrating with solanaweb3js
from fast-text-encoding.
yers please i need it also
from fast-text-encoding.
@samthor can you please let us know what is the status of this feature request?
from fast-text-encoding.
Till the pull request is approved you can use my branch
npm install github:eduardhasanaj/fast-text-encoding#add-fatal-option-support
from fast-text-encoding.
The PR #29 doesn't cover all cases, i.e., it will not detect invalid UTF-8:
- it only covers one failure mode of UTF-8 encoding (it doesn't check continuation bytes) for the fallback code
- it doesn't support Node (
Buffer
does not throw, it generates U+FFFD characters for invalid input)
for folks on the thread, the two questions you need to ask are:
- do you actually want UTF-8 validation, or do you just have some upstream library that expects
fatal
to be supported - why do you want this at all: modern Node and browsers do not need this polyfill (I wrote it in 2017!), and I'd go as far as saying including it is actively harmful.
from fast-text-encoding.
@samthor I agree that #29 does not cover all cases on detecting invalid utf-8 for the reasons you mentioned.
- Some upstream library expects fatal mode to be supported.
- I nedd this polyfill in React Native.
from fast-text-encoding.
Related Issues (13)
- out of stack space when string is too long HOT 1
- LICENSE file includes Apache license template, rather than filled-out license HOT 2
- I'm Sorry
- Could you guys please support utf-16le HOT 4
- Null padded string length not preserved HOT 1
- get [Error: Cannot create URL for blob!] HOT 1
- feat: why not use `codePointAt`? HOT 1
- Probably not needed anymore? HOT 2
- FastTextEncoder and FastTextDecoder being assigned to `scope` regardless if instance already present?
- IE11 doesn't work HOT 7
- utfLabel argument does not support "utf8" HOT 2
- 19 Reasons Why It Is Not "Fast" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-text-encoding.