Quote marks display as a box in the window

I read a text file with createReader() and then displayed the contents in a window with text(). The text displayed properly except that single and double quote marks displayed as boxes. Is there is simple way to fix this?

1 Like

Are you using some special font? Does the text file use UTF-8 encoding?

1 Like

I created the text file with Microsoft Word and saved it as a plain text file with a txt extension. The font was Calibri (Word’s default on my computer). Here’s the code I used to read the file and display it in a window:

def setup():
global line
size(1200,800)
reader=createReader(“SampleText3.txt”)
line=reader.readLine()

def draw():
global line
background(255,255,255)
fill(0,0,0)
text(line,100,100)

When I ran the code, both single quotes and double quotes showed up as boxes in the window.

1 Like

Maybe Word is doing something weird with the encoding. Try copy-paste your text from the Word document into this online text editor:

https://www.editpad.org/

Cllick the “Download & Save” button when you’re done. Try that version of the file with your sketch.

1 Like

You were right. It was a Word problem. When I created and saved a textfile using Notepad, the quotes displayed properly. Thanks for your help.

3 Likes

Yeah, like my iPhone Word replaces normal " with “ which look more beautiful but have another ascii/utf code.

1 Like