~ overflow ~

Tag: accent

Real VNC Viewer on Windows + VNC Server on Linux = Accent Issues

by z3n on Jun.05, 2009, under Linux Happyness

Problem:

Accents (á,à,ã,etc) not working on vnc viewer, for example:

instead of  á it shows  ”a (double ‘)

Solution:

I’ve been looking around for a long time to fix this issue, i haven’t found any relevant information about it.

So i decided to install a different VNC client program, turns out that TightVNC Fixed the issue.

Note that it will not work if you don’t configure your keyboard proprietly on linux, I write in portuguese and english, so as keyboard i have Generic International keyboard, as layout Brazil / Brazil.

Leave a Comment :, , , , , , , , more...

Javascript to Replace Accent Chars

by admin on Oct.18, 2008, under Coding

Problem:

convert accent html encoded chars, like ç , to their real values in javascript

Solution:


var _chr=[];var _etn=[];for(var x=0;x<95;x++){_chr[x]=(x+161);_etn[x]="&#"+(x+161)+";";} // replacing all chars could be slow you would like to restrict it to only the accent chars or the ones that you like
function chr(x){return String.fromCharCode(x);}
function e2c(s){for(var x=0;x<95;x++){var m=s.indexOf(_etn[x]);while(m!=-1){s=s.replace(_etn[x],chr(_chr[x]));m=s.indexOf(_etn[x]);}}return s;}

you can test by:

alert(e2c(“&#161;&#161;&#161;&#161;&#162;&#231;&#231;&#227;&#164;&#165;&#191;”));

to do the reverse just change the order of the replace vars

note that javascript is lame and don’t have array replace and it will only replace a single char on the string (even if there’s more) so lots of loops had to be added to it, this might be a drawback if you use this too many times into a same page or into very large texts.

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!