Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how translate unicode to Thai by JavaScript

    Hi there, I'm trying to write API using JavaScript for Winpos Printer now the printer can print out in English characters but I would like it to print out in Thai character. I have tried to do the code page setting like MSComm1.Output= '\x1B\x7422; which 22 means Thai code page but it still cannot print in Thai. The character printed out is like the alian charaters. Could anyone help me how to get the printer to print in Thai characters please?

    Thank you everyone for helping me

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Did you see Thai characters when you enter in the browser? If so, when you print it should be OK.

    If you didn't see Thai characters in the browser, you need to change the browser codepage to include Thai (Windows). Select - Tools > Internet Options > Languages (add) > Thai.

    That assumes that your print is capable of printing Thai or non-Roman characters.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    I think you'd need to follow
    Quote Originally Posted by wikipedia
    1. Install at least one Unicode font in your system, associated with the language that you want to view correctly, or install a Unicode font which contains large character set for many different languages.
    2. Go to Start > Control Panel.
    3. If you are in "Category View" select the icon that says "Date, Time, Language and Regional Options" and then select "Regional and Language Options".
    4. If you are in Classic View select the icon that says "Regional and Language Options".
    5. Select the "Languages" tab and make sure you select the option saying "Install files for complex script and right-to-left languages (including Thai)". A confirmation message should now appear - press "OK" on this confirmation message.
    6. Allow the OS to install necessary files from the Windows XP CD and then reboot if prompted.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Thank you for your response "abduraooft" and "Philip M". I have to sorry that I haven't explained my problem clearly. My computer can write and display Thai char properly.

    My situation is: I have to press Print button on HTML page which include .js and calls the function within .js file. All the printing style function like line spacing, underlining, and paper cutting will be called from .js file. Also the contents I am going to print out including in .js file.

    Now, I got 2 files: printer.html and printer.js
    printer.js sample code:

    var MSComm1= new ActiveXObject("MSCommLib.MSComm.1");

    // RS-232C port# 1 Baud Rate= 9600 bps, Data bit=8, Stop bit=1, No Parity bit
    var CommPort=1;
    var DataBit=8;
    var StopBit=1;
    var BaudRate=9600;
    var n;
    // Initialization of printer, clear buffer
    var CmdA='\x1B\x40';
    // Carriage Return, print buffer, and line feed
    var CmdCRLF='\x0D\x0A';
    // Cut Paper
    var CmdCut='\x1D\x56\x01';

    // Select the character code table
    function CmdCodePage(n){
    return '\x1B\x74'+'n';
    }

    function CheckPort(){
    if(MSComm1.PortOpen!=true)
    {
    MSComm1.CommPort= CommPort;
    MSComm1.Settings= BaudRate+',n,'+DataBit+','+StopBit;
    MSComm1.Handshaking=0;
    MSComm1.InputLen=0;
    MSComm1.PortOpen = true;
    PaperPrint();
    }
    else alert('Port has been opened!'); // just for testing
    PaperPrint();
    }

    // function to test printing
    function PaperPrint(){
    MSComm1.Output=CmdA;
    MSComm1.Output=CmdCodePage(22);
    MSComm1.Output='WP-K833 ภาษาไทย';
    MSComm1.Output = CmdCRLF;
    MSComm1.Output = CmdCut;
    MSComm1.Output = CmdCRLF;

    }


    And Html file only has a button call function CheckPort(). After clicking the button, the printer prints out "WP-K833" and not following by "ภาษาไทย" but something else not Thai.

    Please anyone help me fix this out.

    Thank you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •