I am trying to display text entries by drawing them in my sketch. All of the text I will be using has quotation marks, and the source I am getting them from has them formatted as “curly” or “smart” quotes.
However, when I loadStrings() from a text file formatted in unicode, and attempt to draw it to the canvas, I get missing characters between each letter:
I have tried with multiple fonts, ones that I know support curly quotes. Is there a way to force Processing to treat Unicode text as ascii or ansi? Is there another fix for this? thanks
Update: When I don’t read the strings from a file, and instead just initialize the String within the program, it works fine (even with using smart quotes)
String s;
void setup(){
size(800, 800);
fill(0);
textSize(35);
textAlign(CENTER, CENTER);
s = "The use of the verb “to fall” (tipol)";
//s = s.replace('\u201D', '\"');
//s = s.replace('“', '\"');
println(s);
}
void draw(){
background(255);
text(s, width / 2, height / 2);
noLoop();
}
Any idea why it’s different when reading from file? And suggestion to how I’d deal with this?
Starting with Processing release 0134, all files loaded and saved by the Processing API use UTF-8 encoding. In previous releases, the default encoding for your platform was used, which causes problems when files are moved to other platforms.