#JC-1986:Fixed encoding issue. Added writer flushing
Now filter can be used in any order