Post text sanitization after publishing/editing – changes are not saved

As @karpstrucking mentioned in the comments, the problem was in the end with my function: my_string_manipulation_function()

I was using preg_replace() to process the string of native language character, but I didn’t used the /u flag modifier to specify that I’m working with unicode characters.
Adding this flag fixed all weird behaviour.