Tuesday, December 20, 2011

Printing Malayalam as C program output at dos prompt, win32

Hai all,

I think we cannot print Malayalam letters in dos prompt. If any body gets a solution, please let me know.

I was just trying to print the malayalam letters using a C Program in windows. I used Visual Studio 2010 to run my  C++ program. Following is program:

Use header files like windows.h, conio.h, tchar.h etc

int _tmain(int argc, _TCHAR* argv[])
{
    TCHAR c;
    SetConsoleOutputCP(863);
    printf("\nHello SDL User!\n");
    printf ("The codepage is %d\n", GetConsoleOutputCP());
    for(c= 3333;c<3455;c++)
    {
              _tprintf(TEXT("%lc\n"),c);
    }
    getch();
    return 0;
}

c= 3333 is the decimal value  of UNICODE for first malayalam letter 'അ'  (0x0D05-hex value).
Ref: http://www.malayalamunicode.com/malayalam-unicode-fonts

But the output was
?
?
?
.
.
.
Why this is because the DOS supports only a few languages whose list can be seen by checking the codepages supported by DOS in following link.
Ref 1: http://en.wikipedia.org/wiki/Category:DOS_code_pages

For Malayalam to be displayed DOS must support code page
57009x-iscii-maISCII Malayalam
 This code page is not supported by DOS as listed in above reference.
Ref 2:http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx

So Sad that unless DOS provides a support for this, we cannot print a malayalam letter in DOS

WIN32 program to print my name in Malayalam --MessageBox
-------------------------------------------------------------
This works for windows 7, but not working in XP
Create new project in visual studio 2010.
File-->New-->Project-->Win32 Project
Name the project
click OK
Finish

include header files stdafx.h, tchar.h.

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, PSTR szCommandline,int iCmdshow)
{
    TCHAR c[4];
    c[0]=3385;
    c[1]=3376;
    c[2]=3391;
    c[3]='\0';
    TCHAR szbuffer[100];
   
    _stprintf(szbuffer,_T("%ls"),c);
    MessageBox(NULL,szbuffer,TEXT("HELLO ALL"),0);
    return 0;
}


Please ensure that , Configuration Properties--->Character set---> Use Unicode Character Set option is selected.




Monday, December 19, 2011

BARE FOOTED GIRL

Bare footed , bare footed , bare footed girl
I just followed her all in the world.

Walking through the sea beach,
I found her footprints in sand.
That made me, follow her,
footprints on the sand.

Long in horizon,
Sun was watching me grant.
I feared somebody,
laughing loud like a band.

Still I followed her, followed her,
followed her footprints.
Droping from her legs,
sand into the sand.

I imagined the particles,
the sand particles,
dropping from her white legs,
droping into sand peg holes.

barefooted barefooted she walk alone,
Searching for somebody all the alone.

Never was she found,
Alone in the ground.
Along the ground.
And never in the crowd.

Followed the footprints,
I walked faster and there was an old man walking far
Bare footed , bare footed , barefooted
Oh, Thats not my barefooted girl...