开发者

char conversion [closed]

开发者_如何学Go This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I want to know what will be the best way for a char-char conversion.

I will create some data for the conversion for example teh letter "A" will be converted to "C" and so on.

Shall I use a MySQL DB or files or what?

Note: The application will be a web app and most likely be running ASP or PHP.

EDIT:

I want to create a website or a desktop app that will allow user who work on PCs that only support one language to be able to use any other language something like a translator, yet it is not a translator.

For example, arabic users cannot use the AR keyboard due to system restrictions, I want to help them write in the language without installing the language pack. I`m facing this problem myself, and can`t install language pack without admin access.

I can`t provide output at the moment as the PC I`m using doesn`t support AR.


I guess you mean character / keyboard mapping (or an Input Method Editor as Ignacio Vazquez-Abrams said)...

In this case, create static hash maps / associative arrays that map keys to characters or strings.
That said, however, I think there are some keyboard mapping tools out there that hook into the operating system and can be customized to one's needs.


What about JavaScript?

Here's a simple code for converting the infamous YZ keys to ZY (QWERTY <-> QWERTZ).

<textarea id="txt"></textarea>

<script language="JavaScript" type="text/JavaScript">
  document.getElementById("txt").onkeydown = InputKeyDown;
  function InputKeyDown(event) {
    var shift = event.shiftKey;
    var keyCode = (event.which == null) ? event.keyCode : event.which;

    //alert(String.fromCharCode(keyCode) + "\\n" + keyCode); return false;

    switch (keyCode) {
      case 89 /* Y */: InsertAtCursor(event.target, shift ? 'Z' : 'z'); return false;
      case 90 /* Z */: InsertAtCursor(event.target, shift ? 'Y' : 'y'); return false;
      default: return true;
    }
  }
</script>

I think you could start something with this. You can also use the event.ctrlKey or event.altKey flags for more complex languages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜