Use UTF-8 for communication with clang-format and convert the replacements offset/length to characters position/count.
Internally VisualStudio.Text.Editor.IWpfTextView use sequence of Unicode characters encoded using UTF-16 and use characters position/count for manipulating text.
Resolved "Error while running clang-format: Specified argument was out of the range of valid values. Parameter name: replaceSpan".