Hi @honkovam, had a similar situation some time ago.
I remember using a notepad++ to find out what the line termination actually looks like in that application and redo that specific line termination in FME. It was also a case of setting the correct encoding value in the writer.
If I remember correctly see View>Show Symbol>Shoe All Characters in Notepad++
Hope this helps.
Could it be that you're writing a single feature where text_line_data contains LF characters?
Hello @itay, @david_r,
Without showing the end of line symbol my file looks just fine in Notepad++:
But as I said - I wanted Windows end of line (CRLF) and I ended up with a mixture - this is what my text file looks like in Notepad++ if I tick show end of line symbol:
I have attached my text file: hp.txt
any idea? thanks
Hello @itay, @david_r,
Without showing the end of line symbol my file looks just fine in Notepad++:
But as I said - I wanted Windows end of line (CRLF) and I ended up with a mixture - this is what my text file looks like in Notepad++ if I tick show end of line symbol:
I have attached my text file: hp.txt
any idea? thanks
How many features did you write for those 6 lines?
Yes, I have one....you need to define 2 types of line terminations...
How many features did you write for those 6 lines?
Hello, just one - it's supposed to be a TFW file for a raster.
The end of line is not working correctly - l keep switching it from Unix to Windows but no effect whatsoever - always shows as Unix.
Yes, I have one....you need to define 2 types of line terminations...
@itay
I think the text writer ignores the End of Line - I keep switching it to Windows / Unix and always end up with LF (Unix)
If I set the end of line to Windows, all lines will show incorrectly as LF (Unix), only the last line will show correctly as Windows CRLF
Any idea why?
Hello, just one - it's supposed to be a TFW file for a raster.
The end of line is not working correctly - l keep switching it from Unix to Windows but no effect whatsoever - always shows as Unix.
I never experienced a difficulty with FME produced world files, but I guess that it depends on the application you intend to use them with
Hello, just one - it's supposed to be a TFW file for a raster.
The end of line is not working correctly - l keep switching it from Unix to Windows but no effect whatsoever - always shows as Unix.
If you write one single feature that contains LF-only newlines, FME won't automatically convert them to CRLF for you. You'll have to do it yourself, e.g. using a StringReplacer.
The Writer line termination settings are per feature.
@itay
I think the text writer ignores the End of Line - I keep switching it to Windows / Unix and always end up with LF (Unix)
If I set the end of line to Windows, all lines will show incorrectly as LF (Unix), only the last line will show correctly as Windows CRLF
Any idea why?
Not really....seems like it should work....but I do remember ending up creating the line terminations myself in an aggregator and not using the writer for it.
I never experienced a difficulty with FME produced world files, but I guess that it depends on the application you intend to use them with
Hi @itay,
the issue is not producing usable world files. It's producing ANY text file (using TEXT file writer) with correct Windows end of line. I set it as Windows end of line in my workbench but FME ignores this setting and produces Unix :(
I'm sure there are other ways, but try a PythonCaller with the following code just before the writer:
import fmeobjects
def FeatureProcessor(feature):
text = feature.getAttribute('text_line_data')
if text:
feature.setAttribute('text_line_data', '\r\n'.join(text.split()))
I repeat that if you send one single feature to the text writer, and that feature contains a string that looks like this:
This is a<LR>multiline text<LR>text file
Then the behavior you observe is exactly as predicted, because the line termination settings only apply AFTER each feature. But the Python code above will fix it for you.
I'm sure there are other ways, but try a PythonCaller with the following code just before the writer:
import fmeobjects
def FeatureProcessor(feature):
text = feature.getAttribute('text_line_data')
if text:
feature.setAttribute('text_line_data', '\r\n'.join(text.split()))
I repeat that if you send one single feature to the text writer, and that feature contains a string that looks like this:
This is a<LR>multiline text<LR>text file
Then the behavior you observe is exactly as predicted, because the line termination settings only apply AFTER each feature. But the Python code above will fix it for you.
hi @david_r,
thanks for the python solution! that worked! much appreciated..