function getCharacterLen(str)
    local nStrLen = 0
    for uchar in string.gfind(replaceNewLine(str), "[%z\1-\127\194-\244][\128-\191]*") do
        if string.len(uchar) == 3 then
            nStrLen = nStrLen + 2
        else
            nStrLen = nStrLen + 1
        end
    end
    return nStrLen
end