Added encoding support to ucfirst method