I’m creating a simple JavaScript multiple choice game. Here is a sample question:
p ∧ q ≡ q ∧ p by which rule?
When I run it on localhost, it works fine, it prints out those special characters. However, when I upload it to my school’s server, it prints out garbage:
p ∨ q ≡ q ∨ p by which rule?
I have this at the top of my HTML:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I can’t use PHP in my assignment, or I’d use header('Content-Type: text/xml, charset=utf-8');
If you want, I can give a link… but I’d rather not because then everyone can see my really bad educational game…
How can I keep my UTF-8 characters?
Edit: I found out that if I Filezilla my files up to the server and download them from the server, the characters become little squares. I don’t know if that’s useful information.
If you cannot easily fix the HTTP headers, escape from the problem by using “character escapes.” If e.g. “∧” occurs in HTML content, use
∧for it. If it occurs in a JavaScript string literal, use\u2227for it.To check out the codes for other characters, consult e.g.
http://www.alanwood.net/unicode/mathematical_operators.html