have you tested if the '\n' is returned again from fribidi (by testing this function with a multi-line string)?