Causes and countermeasures when line breaks occur in file data when uploading / downloading files by FTP-Filezilla-
- Published:
category: FTP

FTP used when creating your own theme with WordPress or transferring a php file with code written based on some information. When using this on the personal computer side, use FTP client tools such as “ffftp”, “Filezilla”, and “WinSCP”.
I have been transferring files with “Filezilla” many times, but the following problems occurred while verifying my own theme.
- When I upload a file by FTP and download it again, some files are selfish? Line breaks enter each line
- If you upload (or install) the compressed theme and download it by FTP, some files will have line breaks on each line.
- After uploading, updating (or installing) the compressed theme, if you download it using the theme download plugin, no problem will occur.
Of course, I know that the file used in WordPress is “UTF-8N” and the line feed code is “LF” or “CRLF”, and the file before uploading is corrected after checking them. Nevertheless.
Specifically, the line feed code changes like this (same for LF, the image above is before transfer, the bottom is after transfer)


However, the above verification made it clear that it would occur when uploading or downloading using an FTP client, so I came to the point where something was likely to happen in the “Filezilla” settings I’m using.
Well then, it seems to be a matter of how to do it with method 3, but there is also an opportunity to transfer by FTP, it is difficult to correct each time, and in the end it will be corrected every time, so take measures. did.
Setting method to prevent the line feed code from changing when transferring files with “Filezilla”
Now that you know what’s happening when you transfer the file, review the settings.
Start Filezilla and open “Edit”-> “Settings”.

Click “FTP: File Type” on the screen that appears.

In the “Default transfer type” field, change “Automatic” to “Binary” and click “OK” at the bottom left to close it (red frame).
This will allow the file to be transferred “plain” and the problem will be resolved.
If you want to set more finely, you can solve it in the same way by deleting “css” “php” “js” etc. that may be transferred by WordPress in the blue frame part (since it is the same, I simply binary I made it)
This can be solved with just this work, so if you are in trouble, please set it.
Since I have not tried to see what I uploaded once on the theme editor, I have not verified whether it occurs by uploading / downloading or when it is first uploaded, but eventually Even so, it can be solved by changing the above settings.
Bonus: Depending on the text editor, the character code and line feed code may not be what you want.
It has nothing to do with this case, but I use “TeraPad” for text editing.
In this editor, even if you save with the character code set to “UTF-8N” and the line feed code set to “LF”, the character code becomes “SHIFT-JIS” or the line feed code becomes “CRLF” when you reopen it. I’m here.
I haven’t researched it well, but in “TeraPad”, is it a character code and line feed code check program when saving? Seems to work, and there are things that inevitably become “UTF-8N” and “CRLF”.
There are times when you can save it properly when you change it to “UTF-8”, but if you upload it to the server in that state, it may not work properly.
Although it seems to have been tested, it seems that it works without any problem even if the character code and line feed code are “SHIFT-JIS” and the line feed code is “CRLF”, and when I checked these with some themes, all of them There were quite a few files with “SHIFT-JIS” and “CRLF”, so I wonder which one is fine. I think, but it may be a problem when the character code collation is strict (inflexible).
- Tags:
- Filezilla
Post Author: Knowledge Base Admin