1. Forum
  2. >
  3. Topic: Esperanto
  4. >
  5. Bookmarklet to convert x-nota…


Bookmarklet to convert x-notation into ĉĝĥĵŝŭĈĜĤĴŜŬ while typing (in any modern browser)

To use

  1. Type in Esperanto <-- Drag this link to your bookmark bar

  2. Click the bookmark while on any website. From then on, it will automatically convert x-notation (cx, gx, hx, jx, sx, ux, Cx, Gx, Hx, Jx, Sx, Ux) into ĉĝĥĵŝŭĈĜĤĴŜŬ while typing (until you reload or leave that page).

If you find that you need to write something like 'ux' for some reason, you can write 'x' first, then go back and put the 'u' in front of it.

Hi all,

I just joined yesterday and started the Esperanto course.

At the bottom of the Basics 1 lesson, I noticed it said, "Note that Duolingo will not convert accented characters entered via the x-system in the answer immediately when typed".

So I created a bookmarklet that does just that. You can use it on any website, and it will convert things like sx to ŝ as you type.

The script stops when you go to a new page, or reload the page.

Tested and working in Chrome, Firefox, Internet Explorer, Opera & Safari.

I'll be using it while I learn Esperanto. I just thought I'd post it here in case anyone else found it useful.

July 25, 2015



Edit 1: redid code

  1. Now changes the letter instantly
  2. Now only changes the letter you type the 'x' next to.
  3. Shorter more efficient code
  4. Added a draggable link making it easier to bookmark

Edit 2:

  1. Added support for Internet Explorer. (It should now work in all modern browsers.)
  2. Added search box functionality (I noticed it wasn't working in Wikipedia's search box. It does now.)

Edit 3:

This was odd, but I actually had to change the script so that the link would work on Duolingo's message board (backslash '\' doesn't seem to be allowed in a link). Now one link works for every browser.

Expanded code for readability:

<pre>javascript:(function(){ var d=document,s=String.fromCharCode,u={C:s(264),c:s(265),G:s(284),g:s(285),H:s(292),h:s(293),J:s(308),j:s(309),S:s(348),s:s(349),U:s(364),u:s(365)}; d.onkeypress=function(e){ if(e.charCode===88||e.charCode===120){ var a=d.activeElement,t=a.type; if(t==='text'||t==='textarea'||t==='search'){ var v=a.value,p=a.selectionStart,c=v.charAt(p-1); if(c.search(/[cghjsuCGHJSU]/)!==-1){ a.value=v.substring(0,p-1)+u[c]+v.substring(p); a.setSelectionRange(p,p); e.preventDefault(); } } } } })(); </pre>


Ok, yoŭ are awesome.

Tĥank yoŭ!


Thanks for the upvotes and kind words! This is a nice community.


Works great on Safari as well. Thank you very much.


Thank you for trying it and letting me know! Safari's now added to the "tested and working" list.


We have such talented people on here.


Thanks! That's great.


Quick question...

I'm now seeing a few posts where people talk about h-notation. But some are saying there are problems with it. What are the problems?

Are there any valid Esperanto words where 'h' comes immediately after 'c', 'g', 'h', 'j', 's', or 'u'? Or can 'ch' and 'sh' be used in names? Or do all proper nouns become Esperanto-ized?

It would be easy to make this bookmarklet work for h-notation as well, if people wanted that. The one benefit I see is that 'sh' is easier to type than 'sx'. But I also see a problem, where someone may want to type Esperanto mixed with another language like English.


Using the combination with "h" may not be such a good idea. Several Esperanto words have that combination. From Bertilo : "senchava" (making sense) "flughaveno" (airport), "seshora" (six hour (long movie)) to name a few.

Edit: but of course if some prefer the "h" solution I will not stand in their way. Personally I prefer the "x" though.


Thank you! That's exactly what I was wondering about.

Making it work would for h-notation wouldn't be as easy then, since it would have to check for valid words against a dictionary. X-notation seems superior since it's not ambiguous.

Thanks again!


I use a comma (,) on my keyboard, so

  • , + c => ĉ
  • , + g => ĝ
  • , + h => ĥ
  • , + j => ĵ
  • , + s => ŝ
  • , + u => ŭ

Does that would be possible in your system?


With the following bookmarklet, if you type one of these letters (cghjsuCGHJSU) after a comma, the comma is replaced with the corresponding letter (ĉĝĥĵŝŭĈĜĤĴŜŬ).

bajanisto style <-- Drag this to your bookmark bar.

That's a clever way of doing it, since there's normally a space after a comma! Is it common?


Thanks! — It works well!

Yes, a space is very common.


Pardonu mi. Mi volas demandi: Ĉu la metodo de uzi komo, fari literojn kun diakritoj, estas komuna?

Kaj dankon! Mi feliĉas, ke vi povas uzi ĝin!


Miakomprene, tiu metodo (kun la komo) ne estas tre ofte uzata, kvankam en la programetoj EK kaj Tajpi estas tiu eblo. Mi ja komencis uzi ĝin en mia propra ÅUIOGX-klavaro antaŭ 6 jaroj. La ÅUIOGX-klavaro (finne: ÅUIOGX-näppäimistö) estas optimizita por la finna kaj Esperanto.

Miaopinie, la metodo estas tre bona, ĉar ĝi ebligas uzi ambaŭ manojn pro la (bona) situo de la komo sur klavaroj.


Thank you very much for this! :) I did notice that it doesn't seem to work on the Lernu site.


Hi! Thank you for trying it!

I made an account on Lernu to try this and I see what you mean. Looking at their code, it's a very old style of writing webpages; like 15 years old. We don't write pages like that anymore.

  1. Whenever you click the "next" arrow or "Sendu", it loads a completely new HTML page. For security reasons, JavaScript is tied to the page it's run on. So each time it loads a new page, the script stops and you have to run a new one. If I could directly update their site, I could include this functionality, no problem. But with a bookmarklet, it means you have to click it again for each new question (HTML page).

  2. The dictionary (vortaro) is also a separate HTML page in a little frame, so the bookmarklet wasn't seeing it. This page also reloads with each new question.

I've added code to make the dictionary work.

Type on Lernu <-- Drag this to your bookmark bar.

But there's nothing I can do about the page changing each question. If you want to use this bookmarklet on a question, you have to click it each time.


When using the "Type on Lernu" booklet mark, and then typing in the the Lernu Dictionary field, hitting Enter no longer seems to send the text to be translated, and requires a mouse click on "Ek!". Not sure if that's something that can be fixed on your end, but just something I noticed.


Hi! Thanks for pointing that out! I added a little more, and now hitting 'Enter' should work.

I updated the link. Just delete the old bookmark and drag 'Type on Lernu' back up again.


Wow ĉu ĝi estas ĉi bonege? Jes, ĝi vere estas! Ĝi tute funkcias! Bonege! Mi amas vin! Koran dankon! Lol. Ĝojege mi ĉeestis la novaĵejojn kaj lanĉis miajn planojn kun ŝipoj da aŭstraliaj akvoj! Ĥorloĝo (Mi ne certas ĉu la antaŭa vorto estas vere E-a vorto, sed eble ĝi estas..?) Ĵus nun mi uzas vian esperantilon, kaj mi tre ŝatas ĝin. Dankon.


Dankon! Mi feliĉas, ke vi uzas ĝin!


Tre stranga. Ĉi tie funkcias tute bone, sed en gmail ne funkcias. Ĉu mi faras io erare? Aŭ ĉu ne funkcias por gmail?


Mi bedaŭras. Ĝi ne funkcias en gmail. Gmail uzas alia stilo de fenestreto: "contentEditable". Ankaŭ, gmail ne permesas ĝin vidi kiu klavo estis premita. Mi ne scias kiel ripari ĝin.


Thanks! I wanted to make a bookmarklet like this myself but my Javascript abilities just weren't up to the task. This is great.

Learn Esperanto in just 5 minutes a day. For free.