Backport #9227 "Fix path completion when UTF8 char is occurring before match characters."

I have backported #9227 "Fix path completion when UTF8 char is occurring before match characters." to 0.3.3 @stevengj