Can't print certain characters.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Lemony Lime
Prole
Posts: 22
Joined: Fri Dec 28, 2012 9:35 pm

Can't print certain characters.

Post by Lemony Lime »

I'd like to print some unusual ascii characters, and using the standard font/print I get the following error: "graphics.lua:1265: Decoding error: Invalid UTF-8"
And if I set notepad++ to encode it UTF-8 so it can actually display the character: "graphics.lua:1273: Decoding error: Invalid UTF-8"

An example:

Code: Select all

love.graphics.print( "█", 100, 100 )
I'm not sure what it means exactly. Any ideas?

Edit: I Just noticed that if I do this line, it prints the █ no problem:

Code: Select all

love.graphics.print( "â–ˆ", 100, 100 )
That's kind of a hassle to do though versus alt+219. What's the difference?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Can't print certain characters.

Post by raidho36 »

I just added love.graphics.print( "█", 100, 100 ) to my code and it instantly worked. My guess is that you have invalid UTF-8 encoding... hence the error. Make sure you encode your scripts as UTF-8 without BOM.
User avatar
Lemony Lime
Prole
Posts: 22
Joined: Fri Dec 28, 2012 9:35 pm

Re: Can't print certain characters.

Post by Lemony Lime »

Well, shoot you're right. I didn't know what BOM was, so I just did UTF-8 encoding, and never tried that other option. Guess I should have. It works now, thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests