Unicode Code Point U-XXXX to UTF8 Conversion

utf

Unicode Code point for अ is  U-0905 

Hex (0905)  Binary (100100000101) no. of bits = 12 bits

Greater than 11 and less than equal to 16, so as per http://en.wikipedia.org/wiki/UTF-8, select below pattern,
1110xxxx    10xxxxxx    10xxxxxx

and on filling x with  original bits, you get,
1110xxxx    10100100    10000101   =>  e0 a4 85

also refer to http://www.utf8-chartable.de/unicode-utf8-table.pl?start=2304&number=128

How to display Hindi text on FLTK

hindi

 

================
test_hindi.cxx
================
#include <string.h>

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Multiline_Output.H>
//
// UTF8 Hindi Test Program
// Author – Venkat

// hindi अ, आ, इ, ई
const char *hindiwords[] = {
“1: \xe0\xa4\x85\xe0\xa4\xa8\xe0\xa4\xbe\xe0\xa4\xb0″,
“2: \xe0\xa4\x86\xe0\xa4\xae\xe0\xa4\x82″,
“3: \xe0\xa4\x87\xe0\xa4\xae\xe0\xa4\xb2\xe0\xa4\xbf”,
“4: \xe0\xa4\x88\xe0\xa4\x96″,
0
};

int main() {
Fl::set_font(FL_HELVETICA, “Hindi Font”); // uncomment for linux
Fl_Window *win = new Fl_Window(500,500,”Hindi Test”);
Fl_Multiline_Output *output = new Fl_Multiline_Output(140,10,340,400,”Output”);
output->labelsize(22);
output->textsize(22);
Fl_Choice *choice = new Fl_Choice(140,output->y()+output->h()+10,340,30,”Choice”);
choice->labelsize(22);
choice->textsize(22);
for ( int t=0; hindiwords[t]; t++ ) {
choice->add(hindiwords[t]);
output->insert(hindiwords[t]);
output->insert(“\n”);
}
choice->value(0);
win->resizable(win);
win->show();
return(Fl::run());
}

utf8-hindi

Code Metrics on VS project

press CTRL+SHIFT+F, and in the window that pops up choose “use regular expression”.
Use this Regular Expression: ^:b*[^:b#/]+.*$

or

DPack does this. After installing, just go to Tools -> DPack -> Solution Statistics…
http://www.usysware.com/dpack/