those obscure UnicodeDecodeErrors

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
jack_norton
Lemma-Class Veteran
Posts: 4067
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

those obscure UnicodeDecodeErrors

#1 Post by jack_norton » Tue Oct 23, 2012 4:27 am

I was wondering if there was a way to avoid those errors:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 1142021: invalid start byte
or at least make them more humanly readable? :lol: I mean, probably it's my fault if I used some weird uncommon character but still, I don't understand why the message couldn't be clearer?
Right now when that happens the only way I have to fix it is to manually delete parts of the text, in a sort of word-hunting to see which is the offending character. Often it's a simple "-" encoded by Word/other crap external text editor. Possible that there isn't an easier solution ?
Last edited by jack_norton on Tue Oct 23, 2012 4:53 am, edited 1 time in total.
follow me on Image Image Image
computer games

User avatar
junna
Veteran
Posts: 347
Joined: Sat Sep 08, 2012 4:16 am
Projects: DreamWalker; History; Adversity Competition
Contact:

Re: those obscure UnicodeDecodeErrors

#2 Post by junna » Tue Oct 23, 2012 4:35 am

I encountered this while coding for the Adversity competition. Unfortunately, the bloody thing is never clear on where the problem is.
I found it's usually triggered by ', " and - symbols only.

So...I either converted my whole in Word to Unicode ANSI font before transferring to Renpy. Or used the Replace in Editra, copy the funky looking ', " and - (I ended up having a template of the problem parts) to find and type in the same symbol to be replaced.

EDIT: Adding another symbol, the '...' thing that Word sometimes autocorrect.
chibi avvie by Meg (buprettyinpink).
WIP=>Image
Image<=helping out

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4067
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: those obscure UnicodeDecodeErrors

#3 Post by jack_norton » Tue Oct 23, 2012 4:52 am

Yes but in my case is even more complex! Check the image:
Image
In the new Editra (on bottom), the text appears clean, while in the good old SCiTE (the best editor IMHO, shown at the top) it shows the culprit: did you see that weird looking character ? I asked the writer and maybe the problem is that she used Openoffice and then copy/pasted the texts on the Ren'Py editor. Apparently the characters are normal, but then if you try to run the game... :mrgreen:
Last edited by jack_norton on Tue Oct 23, 2012 4:56 am, edited 1 time in total.
follow me on Image Image Image
computer games

User avatar
KittyKatStar
Veteran
Posts: 433
Joined: Mon Sep 03, 2012 11:12 pm
Contact:

Re: those obscure UnicodeDecodeErrors

#4 Post by KittyKatStar » Tue Oct 23, 2012 4:54 am

OTL

There was no error when another Mac-user tested the script, so I guess it's the Mac to PC thing.

(I'm so sorry. ;_; Just give me the whip, I know what to do.)

We agreed to use .txt docs from now on and we'll see if it makes a difference.
Last edited by KittyKatStar on Tue Oct 23, 2012 5:01 am, edited 1 time in total.
Image

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4067
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: those obscure UnicodeDecodeErrors

#5 Post by jack_norton » Tue Oct 23, 2012 4:58 am

Haha no sorry, no whip needed. In this case isn't your fault, but really some crazy behavior, I couldn't notice any problem myself until I had the idea to use the old SCiTE ! :D
Hope this info will be useful if someone else has those issues.
follow me on Image Image Image
computer games

User avatar
junna
Veteran
Posts: 347
Joined: Sat Sep 08, 2012 4:16 am
Projects: DreamWalker; History; Adversity Competition
Contact:

Re: those obscure UnicodeDecodeErrors

#6 Post by junna » Tue Oct 23, 2012 5:10 am

0_0 the heck is that symbol?

@_@ I'm sorry, I remembered I converted files a few times and the symbols still came up like this “ .
but in the end, I wrote half of the script in Notepad. T_T that was tough. but I didn't have to Replace anything, phew.

Then I prepared a template/table. Like so:

“ = "
” = "
‘ = '
’ = '
– = -
… = ...

so I just go through Replace one by one each time I cut and paste from Word. It's a bit time consuming using Replace but it solved my Word to Editra problem.
chibi avvie by Meg (buprettyinpink).
WIP=>Image
Image<=helping out

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: those obscure UnicodeDecodeErrors

#7 Post by nyaatrap » Tue Oct 23, 2012 5:13 am

I have encountered that UnicodeDecodeErrors million times... ┐(´д`)┌
I just need to type everything on one editor, avoiding copy and paste from any others as possible. Writer type application only works well on just one language - in my case, Japanese.

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: those obscure UnicodeDecodeErrors

#8 Post by AxemRed » Tue Oct 23, 2012 5:46 am

<< SOLUTION: SAVE YOUR SCRIPTS AS UTF-8 >>

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4067
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: those obscure UnicodeDecodeErrors

#9 Post by jack_norton » Tue Oct 23, 2012 5:53 am

Hmm nope, I tried that, the error was still happening. I tried everything:
- Editra "reload with encoding" to reload the same script as UTF-8,
- opened the .rpy in notepad and saved it as UTF-8

And nothing worked. The only solution was to manually delete those weird characters :(
follow me on Image Image Image
computer games

User avatar
junna
Veteran
Posts: 347
Joined: Sat Sep 08, 2012 4:16 am
Projects: DreamWalker; History; Adversity Competition
Contact:

Re: those obscure UnicodeDecodeErrors

#10 Post by junna » Tue Oct 23, 2012 5:56 am

jack_norton wrote:Hmm nope, I tried that, the error was still happening. I tried everything:
- Editra "reload with encoding" to reload the same script as UTF-8,
- opened the .rpy in notepad and saved it as UTF-8

And nothing worked. The only solution was to manually delete those weird characters :(
I think he meant... save the Word script into UTF-8. I'm gonna go try that for a sec.

EDIT: didn't work...
chibi avvie by Meg (buprettyinpink).
WIP=>Image
Image<=helping out

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: those obscure UnicodeDecodeErrors

#11 Post by AxemRed » Tue Oct 23, 2012 6:11 am

jack_norton wrote:- Editra "reload with encoding" to reload the same script as UTF-8
Doesn't make sense as the script is not UTF-8.

What does work: Open in notepad++, encoding -> convert to UTF-8 -> save

Edit: Resaving as UTF-8 using notepad.exe also works.

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4067
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: those obscure UnicodeDecodeErrors

#12 Post by jack_norton » Tue Oct 23, 2012 6:32 am

Hmm ok next time will try that (now I already fixed the errors manually). Thanks!
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: No registered users