473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

web site to translate spanish characters into corresponding htmlcodes?

Hi,

I have certain blocks of Spanish text, for example

¿Necesita agregar una impresora o copiadora adicional a su forma
personalizada de orden? Presione aquí.

Don't know if the backwards question mark and the accented "i" came
through, but I was wondering if anyone knew of a site where I could
cut and paste the above and it would spit back the corresponding html
codes (e.g. {) for the appropriate Spanisn symbols.

Thanks for any advice, - Dave
Jun 27 '08 #1
10 2637
..oO(laredotornado)
>I have certain blocks of Spanish text, for example

¿Necesita agregar una impresora o copiadora adicional a su forma
personalizada de orden? Presione aquí.

Don't know if the backwards question mark and the accented "i" came
through, but I was wondering if anyone knew of a site where I could
cut and paste the above and it would spit back the corresponding html
codes (e.g. {) for the appropriate Spanisn symbols.
With UTF-8 you could write all those chars literarily without any
character references.

Micha
Jun 27 '08 #2
In comp.infosystems.www.authoring.html message <a2cb0dce-8809-4123-bfd6-
43**********@s13g2000prd.googlegroups.com>, Mon, 14 Apr 2008 19:16:05,
laredotornado <la***********@zipmail.composted:
>I have certain blocks of Spanish text, for example

¿Necesita agregar una impresora o copiadora adicional a su forma
personalizada de orden? Presione aquí.

Don't know if the backwards question mark and the accented "i" came
through, but I was wondering if anyone knew of a site where I could
cut and paste the above and it would spit back the corresponding html
codes (e.g. {) for the appropriate Spanisn symbols.
I see the inverted question mark, but no accents.

One could easily be written, e.g. by yourself. A TEXTAREA for input, a
BUTTON, a TEXTAREA for output, and a series of RegExps, acting on the
content of the first area and writing to the second.

DEMO : ake a copy of my <URL:http://www.merlyn.demon.co.uk/js-
quick.htm>; put ¿Que? in F.X0, F.X1.value = F.X0.value.replace(/¿/g,
"{") in the textarea, press Eval, and read F.X1. Then copy F.X1
to the textarea, press HTML, and observe that it's not { that you
need (it's ¿).

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jun 27 '08 #3
laredotornado wrote:
Hi,

I have certain blocks of Spanish text, for example

¿Necesita agregar una impresora o copiadora adicional a su forma
personalizada de orden? Presione aquí.

Don't know if the backwards question mark and the accented "i" came
through, but I was wondering if anyone knew of a site where I could
cut and paste the above and it would spit back the corresponding html
codes (e.g. {) for the appropriate Spanisn symbols.

Thanks for any advice, - Dave
Few years ago I wrote TEDU (freeware). Try it.
http://www.practisoft.cz/?download+en

--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>

Jun 27 '08 #4
Dr J R Stockton wrote:
One could easily be written, e.g. by yourself. A TEXTAREA for input,
a BUTTON, a TEXTAREA for output, and a series of RegExps, acting on
the content of the first area and writing to the second.
If you are going to go that route, write it in Perl and take advantage
of the HTML::Entities module. No need to write all those regexen.
Jun 27 '08 #5
On Tue, 15 Apr 2008, Dr J R Stockton wrote:
>Presione aquí.

I see the inverted question mark, but no accents.
El acento está aquí.
^

--
http://niwo.mnsys.org/saved/~flavell/charset/
Jun 27 '08 #6
On Apr 16, 3:03*am, Scott Bryce <sbr...@scottbryce.comwrote:
Dr J R Stockton wrote:
One could easily be written, e.g. by yourself. *A TEXTAREA for input,
a BUTTON, a TEXTAREA for output, and a series of RegExps, acting on
the content of the first area and writing to the second.

If you are going to go that route, write it in Perl and take advantage
of the HTML::Entities module. No need to write all those regexen.
Then do it yourself <g.

IMHO, it's much easier to do it in JavaScript, the natural language
for the OP's request of a "site", than it would be to learn Perl. And
it turns out that there's no need to write RegExps as such, if one
provides an input area for the user to define the conversions.

The following includes self-test :

<form class=TRY action="#">
<textarea name=T0 cols=69 rows=4>
Replace first field by second field
¿ &amp;#191; Comment follows second TAB
q Q Paste new content into this box
</textarea>
<textarea name=T1 cols=69 rows=4>
Text input
¿que?</textarea>
<br><input type=button value="->" onClick="TextConv(this.form)"><br>
<textarea name=T2 cols=69 rows=4></textarea>
</form>
function TextConv(F) { var St, XX, J
XX = F.T0.value.split(/[\r\n]+/)
St = F.T1.value
for (J=0 ; J<XX.length ; J++) {
XX[J] = XX[J].split("\t")
if (XX[J].length==1) XX[J][1] = ""
XX[J][0] = new RegExp(XX[J][0], "g") }
for (J=0 ; J<XX.length ; J++) St = St.replace(XX[J][0], XX[J][1])
F.T2.value = St }
I did it in my js-misc1.htm#TS; but I'll not be leaving it there if
signs of excessive use appear - take a COPY. RSVP if bugs are found;
tested in IE7 FF2 Op9 Sf3. FF2 has a mini-bug : the testareas appear
to be 5 rows.
BTW, my newsreader did in fact show the accented í, about one pixel
different from a normal one at normal size, but good at 20 pt.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ...
Jun 27 '08 #7
Dr J R Stockton wrote:
IMHO, it's much easier to do it in JavaScript, the natural language
for the OP's request of a "site", than it would be to learn Perl.
That depends on whether the OP knows JavaScript better than Perl. I know
Perl better than JavaScript.
And it turns out that there's no need to write RegExps as such, if
one provides an input area for the user to define the conversions.
Yuck!

So in your solution, the user has to look up the entities himself, and
enter them into a text area, and hope he doesn't make any mistakes.

-------

use strict;
use warnings;
use HTML::Entities;

while(<DATA>)
{
print encode_entities($_);
}

__DATA__
¿Necesita agregar una impresora o copiadora adicional a su forma
personalizada de orden? Presione aquí.
vis-à-vis Beyoncé's naïve papier-mâché résumé
Jun 27 '08 #8
In comp.infosystems.www.authoring.html message <Zq-dncQBL_P-RZvVnZ2dnUVZ
_g******@comcast.com>, Wed, 16 Apr 2008 22:56:01, Scott Bryce
<sb****@scottbryce.composted:
>Dr J R Stockton wrote:
>IMHO, it's much easier to do it in JavaScript, the natural language
for the OP's request of a "site", than it would be to learn Perl.

That depends on whether the OP knows JavaScript better than Perl. I know
Perl better than JavaScript.
Therefore we have different limitations, but they are, as far as has
been written here, equal in number.
>And it turns out that there's no need to write RegExps as such, if
one provides an input area for the user to define the conversions.

Yuck!

So in your solution, the user has to look up the entities himself, and
enter them into a text area, and hope he doesn't make any mistakes.
That is true. But he can use the solution as is, without seeking Perl;
and the content of the area can be copied and pasted for re-use. I've
added a simple test which will verify the entities. Additionally, your
solution does only what was asked for, whereas mine allows more general
substitutions, for which Perl would need more code.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zipTimo Salmi's Turbo Pascal FAQ.
Jun 27 '08 #9
Dr J R Stockton wrote:
That is true. But he can use the solution as is, without seeking
Perl;
So build the Perl solution into a cgi application. Then only the server
needs Perl. I kept the code simple to demonstrate how simple it is to
encode enities in Perl.
and the content of the area can be copied and pasted for re-use.
So can any output from a Perl script.
I've added a simple test which will verify the entities.
Not necessary with the Perl solution.
Additionally, your solution does only what was asked for,
But it does do what was asked for. Isn't that what it is supposed to do?
Yours only does what was asked for if the user manages to do most of the
work himself by hand.
whereas mine allows more general substitutions, for which Perl would
need more code.
Well, yes, but that isn't what the spec called for.
Jun 27 '08 #10
In comp.infosystems.www.authoring.html message <Lu2dnXOW-9ocPpXVnZ2dnUVZ
_j******@comcast.com>, Fri, 18 Apr 2008 07:34:53, Scott Bryce
<sb****@scottbryce.composted:
>Dr J R Stockton wrote:
>That is true. But he can use the solution as is, without seeking
Perl;

So build the Perl solution into a cgi application. Then only the server
needs Perl. I kept the code simple to demonstrate how simple it is to
encode enities in Perl.
You can do that, presumably; my account does not permit it. I have no
need for it myself; I'd use MiniTrue.

>whereas mine allows more general substitutions, for which Perl would
need more code.

Well, yes, but that isn't what the spec called for.
It did not require a lack of other capability, though. I've provided
something that *can* be used, now; you have but written of another
approach.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 7.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/unsupported.
Jun 27 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bengt Richter | last post by:
Just thought None as the first argument would be both handy and mnemonic, signifying no translation, but allowing easy expression of deleting characters, e.g., s = s.translate(None,...
2
by: poisondart | last post by:
Is there a predefined entity set for Spanish accents? I know that I could just easily make one, except that I intend to do this for other languages in the future, which may have more accents than...
9
by: JezB | last post by:
Is there anything in the framework which will help translate accented characters in strings to their standard counterparts? eg. "Gráda" to "Grada"
3
by: Chip | last post by:
There is surprisingly little information on the various encoding options for reading a text file. I have what seems to be a very basic issue: I'm reading a text file that includes Spanish...
2
by: pramod | last post by:
Hi I am facing the problem while inserting the spanish characters in the DB2 UDB v8.2 database. We are pulling the data from SQL server through informatica and then pushing the same in the DB2...
4
by: norikus | last post by:
C will read a text file and store the Spanish characters (á, é, í, ó, ú, ñ, and ¿) as simple ASCII characters. No problem. C#, though, acts as if it's blind. The text string "bahía" read from a file...
5
by: tushar.saxena | last post by:
This post is a follow up to the post at : http://groups.google.com/group/comp.lang.c++/browse_thread/thread/83af6123fa945e8b?hl=ug#9eaa6fab5622424e as my original question was answered there, but I...
4
by: =?Utf-8?B?TGVvbg==?= | last post by:
Hi everybody. I am using streamreader to show spanish .htm page on my website. Unfortunately those spanish characters that have stresses on top (like: Ó,á, ....) do not show correctly. Is...
3
by: Kenneth McDonald | last post by:
I have the need to occasionally translate a single word programatically. Would anyone have a Python script that would let me do this using Google (or another) translation service? Thanks, Ken
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.