Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,869 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,869 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