CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    384

    Half Width and Full Width Characters

    Hi,

    How is it possible to detect half-width and full-width versions of the same Japanese katakana character ?

    In the following code snippet - both the half width version and the full-width version result in the same hexa-decimal value. So, how could one distinguish the half-width version from the full width one.

    Code:
    int _tmain(int argc, _TCHAR* argv[])
    {	
    	
    	cout<<"This is data wil both halfwidth and full width characters"<<endl;
    	stringstream s;
    	s<<hex<<(unsigned int)'カ';
    	cout<<"Full width ka : "<<s.str().c_str()<<endl;
    	stringstream s2;
    	s2<<hex<<(unsigned int)'カ';
    	cout<<"Half width ka : "<<s.str().c_str()<<endl;
    }
    Both the half-width version and the full-width version of the character 'ka' returns 834a as the hexa value.

  2. #2
    Join Date
    Jan 2006
    Posts
    384

    Re: Half Width and Full Width Characters

    From what I could understand in the small article on the wikipedia page -
    Code:
    http://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms,
    it looks like the UNICODE representations of the half/fullwidth forms have different values for the same character.

    So does that mean that we need to do a mbstowcs() or a mbtowc() and then maybe be in a position to distinguish ?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured