added beg2char and char2end