allan2 / dotenvy

A well-maintained fork of the Rust dotenv crate
MIT License
625 stars 39 forks source link

Error: stream did not contain valid UTF-8 #97

Closed suneel-eng closed 4 months ago

suneel-eng commented 4 months ago

dotenvy is finding the file in cargo workspace but giving below error.

stream did not contain valid UTF-8

my .env file contains DATABASE_URL=sqlite:fake_data.sqlite text.

rustc version: 1.76.0 rustup version: 1.27.0 cargo version: 1.76.0 dotenvy version: 0.15.7

Thanks in advance.

suneel-eng commented 4 months ago

It is resolved. Actually it was my fault. the file was saved as utf-16. After changing the text encode to utf-8, it's working.

You can see the text encode of a file in vs code at bottom right. by clicking on it, You can reopen/save the file with any text encoding you want. image