Hi, first off let me say: great job with Deno! Its a truly exciting development in the JS ecosystem...
My Deno script works just fine when I run deno run src/cli.ts. However if I bundle the project and try to run the output .js file, I get the following error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 0, error_len: Some(1) }', cli\file_fetcher.rs:622:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This happens when I run it locally, or refer to the remote url.
Repo
https://github.com/kesupile/ts-percentage
Operating System
Windows 10
using the powershell install
Are there any non-UTF-8 characters in the file?
Nope
I have checked that file , Its encoded in UTF-16 Little-endian Unicode text.
I think the first thing to do is fix the panic, so we'll get a graceful error handling behavior.
Next, consider how we'd like to address the issue, assuming Deno is supposed to support non-UTF8 files.
The core difficulty is that there is no guaranteed way of knowing which encoding a file uses.
Some non-mutually-exclusive approaches:
Content-Type header specifies the encoding, then use the encoding specifiedFYI, I tested this again on master and it no longer panics - now we just get a error: invalid utf-8 sequence of 1 bytes from index 0.
It does panic on 1.0.0 as @kesupile specified.
So, I guess it only boils down to:
I'm starting to work on this
Most helpful comment
I'm starting to work on this