Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Ivan Monge
Ivan Monge
3,327 Points

How can I write Spanish without using special character list in HTML?

So I am trying to write Spanish and several other languages in HTML. But I keep getting ???? when special characters appear such as ñ, á and others. How can I set those up without having to write the characters from the special characters list.

3 Answers

Michael Hulet
Michael Hulet
47,912 Points

Instead of writing the character itself, you can instead use an HTML entity to represent the character. For example, to write an ñ, you could instead write something like this:

<!-- Both of these represent the same character -->
 &ntilde;  &#241;

Here's a good resource on HTML entities for accented characters

Ivan Monge
Ivan Monge
3,327 Points

Yes, but thats exactly what i dont want to do. Wikipedia in Spanish does not use this method and I still dont quite understand how they manage to do it.

Michael Hulet
Michael Hulet
47,912 Points

Alternatively, you can specify that your page is encoded in utf-8, like this:

<head>
    <meta charset="utf-8"/>
</head>

However, the HTML entity method guarantees that all older browsers will be able to understand how to render these special characters, as well