Rotating Quote Javascript and Accents in Spanish Words (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


Jordan -> Rotating Quote Javascript and Accents in Spanish Words (6/16/2008 10:20:48)

I've been working on preparing a Spanish version of my employers company Web site. I don't speak Spanish, so it has been translated for me. I've changed the encoding so the site will show the accents that appear in many Spanish words. The one problem that I have not been able to figure out is a javascript that I'm using to randomly rotate quotes throughout the site. I get that odd little "?" symbol where a letter with an accent should appear. I've tried inserting "\" before the letter as you do for apostrophes and quotation marks, but that didn't do the trick. Here's an example of the script...

This in the head of my document...
quote:

<script language="JavaScript1.1" src="includes/quotes.js">


This in the quotes.js file....
quote:

var quotes=new Array()

quotes[0]='La mezcla única dulce cítrica de las variedades de Arándanos Silvestres entrega un torrente de sabor delicioso de la Madre Naturaleza que no se puede encontrar en ningún otro lugar. Esto significa que sus productos de Arándanos Silvestres tendrán más del gran sabor que sus clientes desean. '

var whichquote=Math.floor(Math.random()*(quotes.length))
document.write(quotes[whichquote])


Surely javascript is used in Spanish Web sites. What am I missing?
Thanks!




Mane -> RE: Rotating Quote Javascript and Accents in Spanish Words (6/16/2008 10:57:38)

Have you tried using HTML entities? For example for ¿, the upside down question mark, put &iquest; into the source code.




Tailslide -> RE: Rotating Quote Javascript and Accents in Spanish Words (6/16/2008 10:57:56)

You'll probably need to switch to UTF-8 from whatever you're using - so try replacing the current character set meta tag with this:

<meta http-equiv=content-type content="text/html; charset=utf-8">




Jordan -> RE: Rotating Quote Javascript and Accents in Spanish Words (6/16/2008 11:22:48)

Yes! Changing the character set worked. Thank you!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
2.929688E-02