maya90
April 8, 2015, 5:16pm
1
hi,
sp chars (Spanish) are not showing in placeholder… this
su correo electrónico
is showing as
su correo electrónico
I’m using this encoding…
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
using entity no. gives me same result:
su correo electró ;nico
how can I fix this, please…
thank you…
Not for me (using below code.)
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<title>Test</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8">
</head>
<body>
<p>su correo electrónico</p>
</body>
</html>
Is your editor set to utf-8?
maya90
April 8, 2015, 6:26pm
3
thank you for your response… but the problem is only in placeholder text (you know, for forms, placeholder in text fields…) i.e.,
<input type="email" name="email" id="email" placeholder="su correo electrónico">
placeholder text should look like:
su correo electrónico
but it looks like this:
su correo electró ;nico
for all other situations, throughout the page (inside <p>'s,
<div>'s,
etc.), special chars look fine…
thank you…
maya90
April 8, 2015, 6:30pm
5
thank you Ryan…
what is the solution? why can’t I get it to work?
I added
<meta charset="UTF-8">
in header… it still doesn’t work…
thank you…
Which browser are you using? I can’t reproduce the issue here with Firefox or Chromium on Ubuntu Gnome. Have you validated your HTML?
ronpat
April 8, 2015, 6:35pm
7
In which browsers does this happen?
(Hi, TB )
maya90
April 8, 2015, 6:43pm
8
happens on both Chrome & FF (am on mac, 10.6.8…)
& yes, I did validate the HTML, no errors (I posted the code of text field with the placeholder text earlier…)
thank you…
Did you check your editor charset? I’m just using the code you provided. Nothing crazy. I’m doing nothing different than you, other than probably having a properly set up editor.
maya90
April 8, 2015, 6:51pm
10
what do you mean by “editor”??? HTML editor?
I’m using Dreamweaver, but I hand-code… does it make a difference in what HTML editor I write the code?
(and again: prob is only for placeholder text – elsewhere throughout the page sp chars look fine…)
I have this tag in header:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
and here’s code of text field with placeholder text:
<input type="email" name="email" id="email" placeholder="su correo electrónico">
thank you…
molona
April 8, 2015, 6:57pm
11
Have you tried to use “electrónico” or “electrónico” instead?
If you’re using UTF-8, the character “ó” should exist
Notepad, Notepad++, Sublime, Dreamweaver. Whatever you use to code.
Nope. Up until a few months ago I was using Notepad.
Your editor replaces the spanish characters with that character code?
maya90
April 8, 2015, 7:04pm
13
acutally yes, and that worked… I just thought it wasn’t proper form to do that… (but: because this text is actually in Javascript (I switch betw two languages)
if (lang === 'es' ) {
// .........
yrEmail = 'su correo electrónico';
// ........
$('input#email').attr('placeholder',yrEmail);
// …
}
it’s not being accepted… you can’t put a “literal” letter w/an accent in a .js file… you get the “not proper encoding” alert… oh brother… ok… will have to switch languages differently on this one…
gotta go… thank you all very much for your help…
PS: but this
errEmail = 'favor poner su correo electrónico';
for error msg works fine… again, prob is only for placeholder text…
molona
April 8, 2015, 7:28pm
14
So then maybe the problem is not in the HTML or the page coding itself but the JS? I guess you’re simply echoing the placeholder text?
maya90
April 8, 2015, 11:35pm
15
no… as I mentioned… I’m doing JS for other content
errEmail = 'favor poner su correo electrónico';
and it works fine… once again: problem with special chars is only for placeholder text (I also hard-coded it…
<input type="email" name="email" id="email" placeholder="su correo electrónico">
same problem…)
thank you…
ralphm
April 9, 2015, 1:08am
16
Hm, works fine on my Mac, but that’s a fairly old OS you are using.
maya90
April 10, 2015, 7:42pm
17
hi Ralph!
yes but surely this doesn’t have to do with OS version I’m running… it’s kind of old, but not that old, come on…
so: still no solution… to this odd problem…
thank you…
ralphm
April 10, 2015, 11:54pm
18
Using the straight é character works fine for me in JS, with no errors. But another option might be to use the escaped form of the é: i.e. \u00e9
in “su correo electr\u00e9 nico ”.
Working demo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<input type="text" id="email">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//var yrEmail = 'su correo electrénico';
var yrEmail = 'su correo electr\u00e9nico';
$('input#email').attr('placeholder',yrEmail);
</script>
</body>
</html>
maya90
April 11, 2015, 9:42pm
19
thank you Ralph… that worked!!!
(however, I need an “ó”, not an “é”… can’t find a list of these escaped chars… tried \u00o9
instead of \u00e9
, but got a JS error…)
found a list here, www.rgagnon.com/javadetails/java-0136.html
but doesn’t include an ó…
thank you very much…
ralphm
April 11, 2015, 11:36pm
20
O man, what an idiot I am. I got distracted and didn’t notice I’d picked the wrong letter. It was meant to be \u00f3 .
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<input type="text" id="email">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//var yrEmail = 'su correo electrónico';
var yrEmail = 'su correo electr\u00f3nico';
$('input#email').attr('placeholder',yrEmail);
</script>
</body>
</html>