Files.readAllLines() throws an exception every time.
I can't figure out why an exception is being thrown by this line of code, it used to work in an earlier version but now it just doesn't. Am I somehow using it wrong?
25 Replies
⌛
This post has been reserved for your question.
Hey @Devin! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Here's how it looks in my code
and that's the stacktrace
For additional context, I am running it from the right place as well
I just don't understand where this comes from? What does it mean "malformed input"?
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
tldr java cant really convert the bytes in the file back to text with the encoding you specified
what’s in the file?
It's weird though, a badly encoded file shouldn't throw an exception, it should produce error characters
Well, what's odd about this is that I actually don't care what the text is in the file
I'm not sure what file it's on, I'll try adding that code to my catch block.
They're all
.mcfunction
files though, none of them should contain characters you wouldn't find in a minecraft command
actually, at least one of them has the ☭ character in it for coin redistribution
could that be it?
oh I see
I can't refer to F in my catch block because I think the scope is too wide?Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
right that makes sense
I'll try moving code around
even the file with that weird char is UTF-8 tho
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
It's literally just a helper class so I don't need to remember the escape sequences
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
yeah I think there are light/dark variants for some of them
These are just the ones I thought I may need for this project
THIS one??
Holy shit
No idea how to fix this
oh wait
Looks like I can fix in in npp
I just did it wrong the 1st time
wow
in 1999 files that was the ONLY one using ANSI encoding
idk how that even got broken
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Post Closed
This post has been closed by <@223590468259282954>.