Yes, '\n' should be maintained in the function.  What I don't know is what fribidi does to the '\n', if anything.  That's what I want you to test.  As long as when you pass in a '\n' terminated string you get a '\n' terminated string back again, all good.