'utf8' codec can't decode byte 0x92 [Solved :)!]

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
acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

'utf8' codec can't decode byte 0x92 [Solved :)!]

#1 Post by acsh »

Testing out a sample of the script but I can't seem to get the game to open :/ This is the full error I get:

I'm sorry, but an uncaught exception occurred.

While parsing C:\Users\User\Documents\Itch/game/script.rpy.
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 685: invalid start byte

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\main.py", line 364, in main
renpy.game.script.load_script() # sets renpy.game.script.
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\script.py", line 265, in load_script
self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\script.py", line 726, in load_appropriate_file
data, stmts = self.load_file(dir, fn + source)
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\script.py", line 549, in load_file
stmts = renpy.parser.parse(fullfn)
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\parser.py", line 2483, in parse
lines = list_logical_lines(fn, filedata, linenumber)
File "C:\Users\User\Videos\renpy-6.99.12.4-sdk\renpy\parser.py", line 194, in list_logical_lines
data = f.read()
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/codecs.py", line 674, in read
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/codecs.py", line 480, in read
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 685: invalid start byte

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187

I've also attached the script. Any help would be so very appreciated <33
Attachments
This file contains the script for the Ren.txt
(6.9 KiB) Downloaded 180 times
Last edited by acsh on Wed Jul 12, 2017 10:15 pm, edited 1 time in total.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: 'utf8' codec can't decode byte 0x92

#2 Post by IrinaLazareva »

First, file must be saved with UTF-8 coding.
Secondly, try to correct

Code: Select all

define RHYF = Character('Rhys's Dad', color="#c8ffc8")
define RHYM = Character('Rhys's Mom', color="#c8ffc8")
to

Code: Select all

define RHYF = Character('Rhys\'s Dad', color="#c8ffc8")
define RHYM = Character('Rhys\'s Mom', color="#c8ffc8")

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: 'utf8' codec can't decode byte 0x92

#3 Post by IrinaLazareva »

here working version.

UPD. By the way,
https://www.renpy.org/doc/html/text.htm ... -text-tags
Attachments
corrected_script.rpy
(6.95 KiB) Downloaded 183 times

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'utf8' codec can't decode byte 0x92

#4 Post by Imperf3kt »

Alternatively

Code: Select all

define RHYF = Character("Rhys's Dad", color="#c8ffc8")
define RHYM = Character("Rhys's Mom", color="#c8ffc8")
Would also work.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

Re: 'utf8' codec can't decode byte 0x92

#5 Post by acsh »

@IrinaLazareva
Thank you for the corrected version and the link...unfortunately I still can't get it to work. I have absolutely nil knowledge of coding so I'd really like to apologize but...how do I actually get it to save as a utf8 file? Editra saves it directly as rpy and I can't find utf under the "save as" options. Sorry, I'm aware this is probably /superbly/ dumb, but yeah...

acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

Re: 'utf8' codec can't decode byte 0x92

#6 Post by acsh »

@Imperf3kt
Thanks for the suggestion. I'll be sure to read up more on Ren'Py's text commands :/ As a total beginner this is all a very complex mystery to me, haha.


EDIT: A long time of researching later, I've concluded that UTF-8 is not associated with the English language whatsoever, and I'll never be able to understand it lol.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'utf8' codec can't decode byte 0x92

#7 Post by Imperf3kt »

Well if you don't like unicode you can always convert it to Octal
0x92 in unicode = 0o222 in octal


Anyway, I took a look at your script and the first thing I noticed was a bunch of Chinese/Japanese characters.







Every single one of these occurs where you would ordinarily have an apostrophe.
I believe these were not part of your initial script and were introduced by Ren'Py after you attempted to launch you script with the previous string error.

The script file IrinaLazareva posted has all of these removed as well as line 114 fixed (you were missing an end "), and works perfectly for me, so if you are still experiencing issues than we need more info to help further.

For now, make sure Editra is set to output utf-8 encoded files (default)
https://puu.sh/wHCKT/e8798c7696.png

Click Edit > Preferences > (general tab) > Files
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

Re: 'utf8' codec can't decode byte 0x92

#8 Post by acsh »

Hey, thanks for helping me out so far. It's rather vexing at this point :/
I tried to set things up as utf but I get CODE, DECODE, etc.?

EDIT:
Oops, I see where I'm supposed to go now. I've switched it over to utf8 but I still don't get the green and black indications...
Is there any particular information I can supply to figure out where the bug is?
Attachments
file.png

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: 'utf8' codec can't decode byte 0x92

#9 Post by Donmai »

A simple method to stop those Editra problems, especially if you are running it on a non-English system, is to simply dump Editra to the trash bin and start using any other editor.

I used Editra for some time on my Portuguese system, and it kept "forgetting" what text encoding I was using and inserting invisible characters in the text, giving me irritating errors. I went back to jEdit and found peace again.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'utf8' codec can't decode byte 0x92

#10 Post by Imperf3kt »

Editra works fine for me on a Japanese locale PC.
Then again, it is because it is set to Japanese locale that Editra uses UTF-8 by default for me.


Can we see the whole game? Is that possible. I have a feeling the issue is elsewhere.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

Re: 'utf8' codec can't decode byte 0x92

#11 Post by acsh »

I got it to work on jEdit!!!! :DD
omg, I can't believe it <33 After so many hours of puzzling and groaning about this issue lol. It's so nice to be able to see the skeleton of my vn coming into place. I CAN'T THANK YOU ALL ENOUGH!!! It's odd 'cause I'm pretty sure I'm running on an english system haha, but anyway jEdit is friendly to me, so I'll stick with it.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 'utf8' codec can't decode byte 0x92 [Solved :)!]

#12 Post by Imperf3kt »

As I was saying before, Windows - on an English PC - does not use UTF-8 by default.
It uses its own ISO character encoding known as CP-1252.
As such, files save as ANSI by default and are incompatible with unicode.
Newer versions of Windows (such as Windows 10) use UTF-16, part of the unicode standard.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx


If you're comfortable with the switch, thats fine, but personally, I'd look into it more as you may experience further, unexpected issues later on.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

acsh
Newbie
Posts: 22
Joined: Wed Jun 18, 2014 11:21 pm
Contact:

Re: 'utf8' codec can't decode byte 0x92 [Solved :)!]

#13 Post by acsh »

As the cross the bridge when you get there sort of person, I think I'll deal with the problem as it comes :p
For now I'm just glad to be plowing away at the script <3

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: 'utf8' codec can't decode byte 0x92 [Solved :)!]

#14 Post by Donmai »

Maybe we should have an "Editra Gripes" section?
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Post Reply

Who is online

Users browsing this forum: Donmai, Google [Bot]