Character Encodings when switching from Linux to Windows - linux

I created a tex-file on Ubuntu. Now I upload the file via FTP on an Apache-Webserver. I am pretty sure, that the server is a unix-based server. After that I download the file from the webserver and I open it with JEdit on Windows-7 and german umlaute (ä, ö, etc.) are looking strange.
I thought: if I change the file-attributes in JEdit to UTF-8 all should be fine, but nevertheless, umlaute are still looking strange.
How can I handle the file-encoding dilemma?
Thanks in advance.

Go to Settings -> Transfers -> File Types in FileZilla and set to binary for the extension you're using for your text file.
If you're using the command line clients, try binary to switch to binary mode.

Related

Edit files in server using text editor

I was wondering, is there a way I can edit files inside a live linux server using a text editor? I am able to edit using the nano command but that is not very friendly. Can I achieve the same using an editor.
vi is an editor. If you mean graphical editor, then it depends. At first glimpse, you have two options: A) Open the file using some file share (nfs, samba, ftp?) on your client computer using your favourite editor, or B) Use some ssh client which is capable of "tunneling" an X connection (putty?) and use an editor running on the server machine, displaying GUI on your client (which acts as an X host).
You can install a better editor, like vim or emacs on your Linux server.
You could also install X-client editors like gedit (and many others) and use ssh -X to access your server. You need some X11 server in front of you (on your laptop).

Tab button in ftp command

I usually use "TAB" button to help me do typing in linux or AIX command, for example, I have a file with file name is abcdefg.txt, so when I want to vi to this file, I just type vi ab then press the "TAB" button in my keyboard, then it will automatically help me search for abcdefg.txt (only have 1 file which is name start with ab).
However, when I ftp to the environment, I can not use "TAB" button, I need to fully type the whole file name. Please advise me how to do this in ftp environment.
Second problem, in ftp environment, when I list all the files in the directory, I saw a file which name is 123456789.txt, however, when I want to rename it like:
rename 123456789.txt 123456789a.txt
it prompt me 550 123456789.txt: A file or directory in the path name does not exist.
But I can rename the other files. I suspect this 123456789.txt file name got some space in some where, that's why I hit the error.
Most FTP programs, especially those which come with proprietary Unices like AIX or HP-UX don't offer readline support. Install a more powerful tool like ncftp to fix this.
To rename files with whitespace, you can try to quote the file name but again, this might fail with bare-bones FTP clients.
When just downloading the file, there is a simple workaround: Use your browser. Every browser supports the ftp:// protocol. The main problem here is security: You have to pass the password via the URL: ftp://user:password#host/ so the browser will put it into its history.
But since you use FTP, security isn't a concern anyway (FTP transmits the password as plain text over the wire, so everyone on the same network can see it).
Another option is mucommander, a cross platform file manager which supports a wide range of protocols and which handles spaces in file names correctly.

How to open non text files in Cygwin?

I am trying to open image files, pdf files and music files using Cygwin, a terminal that provides Linux functionality in Windows. So far I have not successfully executed a command that would accomplish what I want. I can only open text files at this moment using vim text editor.
Edit: Thanks for the comments. I am looking to open files using appropriate windows applications. Also, I do not know how I can figure out whether XServer is already installed and why would I need XServer to resolve my issue in the first place.
Use the cygstart utility, e.g.,
cygstart foo.bmp
will open up the image file in Paint.
It’s in the cygutils package, which I believe is installed by default. It has a man page that shows that you can use it to open URLs in your browser, among other things.

How can I open a local file with a local program through my browser?

On my webpage, I have placed a link to a local file (e.g. "text.docx" on my local HD). I would like to double click on this link, and have a third party software which is installed locally on my PC (e.g. Microsoft Word) open it.
I would like to be able to do this with Firefox and Google Chrome. Obviously, I am a newbie to web programming.. can somebody show me the way? I have looked around and had the impression that I need to write and add an extension, maybe?
Thanks for your time. Jakob
This is only possible if you know either the absolute path to the file or the relative path from whatever working directory your browser runs from. You the create a link with
href="file://relative/path/to/file/text.docx"
or
href="file:///absolute/path/to/file/text.docx"
and any modern browser will query the system database for the mimetype of the file depending on its extension, thus prompting to open the correct application.
EDIT
I inawarently introduced a unixism in the previous code: Distinction bewteen absolute and realtive paths as above works well on current *nix desktops, but in Windows an absolute path will most likely look like
href="file://C:/drive/absolute/path/to/test.docx"
Mind the 2 (not 3) slashes a the beginning, and the forward (not backward) slashes.
As far as I know, you can't link to local files from a website. If you upload it to where your files are, you could then be able to download it.
I was able to execute code locally, using Firefox, by adding an extension which used the XPCOM interface. One such extension was "commandrun", and may be found here: https://github.com/aabeling/commandrun .

Compatibility of x-www-browser

I want to open html files from a shell script. I know that Ubuntu has a command x-www-browser that will open the default browser on the system. I also found via some Googling that the command is part of the debian system. I was wondering if the command is available on non debian based distros. If it isn't is there a standard way of opening an html file in the default browser on a linux OS via command line? Note that I'm using Bash.
If you are wanting to open an HTML file that is local (and maybe even remote, I'd have to check), you can use xdg-open. This is the rough equivalent to "double-clicking" on a file to open it, so it's not limited to html files. Since you want to always open in the user's default browser, this would be the same as if they just opened it themselves.
Of course, if they have their system set up to have HTML files open in a text editor (like I did for awhile), this would backfire. But that's pretty rare.
Quick update
I just checked and xdg-open http://google.com brought up Google in Firefox (my default browser). So it does work for non-local files.
You could use xdg-open.

Resources