panzi / u4pak

unpack, pack, list, check and mount Unreal Engine 4 .pak archives
512 stars 141 forks source link

utf8 codec error #28

Open iixatomxii opened 5 years ago

iixatomxii commented 5 years ago

I've used this software numerous times on tons of games. But for the first time, I've encountered an error saying " 'utf8' codec can't decode byte 0xe6 in position 96: invalid continuation byte"

panzi commented 5 years ago

Hmm, I should probably add an option for which encoding to use in the file name strings. Currently I simply guess it's utf-8. Try replacing all decode('utf-8')/decode() calls with decode('latin1') and see if the script produces plausible output. I'm currently on vacation so I can't help more than that. Only on a phone here.

iixatomxii commented 5 years ago

I have no clue how to do that, I apologize. I'm basic with it. u4pak.py unpack -archive- and u4pak.py pack -archive- -contents- is all I use. Unless you can give some direction of where to put that, I'm willing to give it a shot. If not, I can wait until something is available in a future update to do so

panzi commented 5 years ago

Open u4pak.py in a text editor (not word, notepad on windows 10 or so) and replace all occurrences of decode() or decode('utf-8') (forgot which one I wrote) with decode('latin1'), save, try to use it again. It might even be only one place where I have this decode call.I think on older windows versions notepad will mess up the text file, since it's an Unix text file. There you could use e.g. Notepad++. Maybe wordpad (not word) works, too. On macOS TextEdit should be fine.Written on a park bench in Geneva.

iixatomxii commented 5 years ago

Sorry for not replying after my last reply. I figured out what you were saying after your first message. I found an older reply here on the issues and tried it. This was the result:

Traceback (most recent call last): File "F:\Steam\steamapps\common\AtomUniverse\AtomUniverse_KingPin\Content\Paks\u4pak.py", line 1720, in main(sys.argv[1:]) File "F:\Steam\steamapps\common\AtomUniverse\AtomUniverse_KingPin\Content\Paks\u4pak.py", line 1657, in main pak = read_index(stream,args.check_integrity) File "F:\Steam\steamapps\common\AtomUniverse\AtomUniverse_KingPin\Content\Paks\u4pak.py", line 799, in read_index record = read_record(stream, filename) File "F:\Steam\steamapps\common\AtomUniverse\AtomUniverse_KingPin\Content\Paks\u4pak.py", line 573, in read_record_v4 st_unpack('<QQQI20s', stream.read(48)) struct.error: unpack requires a string argument of length 48

iixatomxii commented 5 years ago

Again, I'm in no rush if this is an issue that would take time to fix whenever you have time. Hell, even if it can't be fixed, I'm not worried about it. Just one game that's given me issues compared to a lot of others that work fine :P

panzi commented 5 years ago

This means either this archive is somehow damaged or of a format variant that my script isn't able to handle. To be more precise: My script thinks the archive file should go on, but it ends there. Maybe the file is truncated? Have you tried to use Steam to check the integrity of the file?

iixatomxii commented 5 years ago

Already have and reinstalled the game to be sure. It's all good though, don't worry about it ^-^ I appreciate the help

DevIhor commented 4 years ago

@iixatomxii I've tried it on Astroneer and got the same issue. Then I tried to understand the bytes unpacking and found that read_record consumes 4 extra bytes (for Astroneer) on each entry_count iterate.

panzi commented 3 years ago

Do you know what pak version Astroneer is using?