File Types (2/2)

From Bluefish Wiki
Jump to navigation Jump to search


 

12.1. Remote files

Assuming a working Internet connection, files can also be opened from the web using File → Open URL. This feature depends on your gnome_vfs setup. If it is installed and working, http://, sftp://, smb:// and possibly more types of remote services should be supported by Bluefish. Depending on your gnome_vfs version, some of these protocols are not yet fully stable, which can crash Bluefish!

File:Man2 open url.png
Opening an URL from the Web

Here you can see the style sheet of an Apache web site, nicely highlighted after its opening via the Bluefish File → Open URL menu.

File:Man2 open url result.png
A Style Sheet opened via the Open URL Menu

12.2. Character encoding

There are many different standards for character encoding of text files. Most well known is the ASCII standard, which describes only 127 characters, and is supported by every text editor in the world. The most common standard nowadays is UTF-8, which describes thousands of characters, and is backwards compatible with ASCII.

Internally, Bluefish will always work with UTF-8. When opening a file, Bluefish has to detect the correct encoding for the file. For HTML files, the encoding should be present in a <meta name="encoding"> tag. Bluefish will always use this tag if it is available in the file. If this tag has an encoding that is not present in the Bluefish config file, this encoding is automatically added to the Bluefish config file.

The locale also defines a default encoding. If you are using a locale (a local setting, defining language, time format, currency format, number formatting etc.), Bluefish will try to load the file using the encoding defined in the locale.

Bluefish itself also has a setting for a default encoding. This is the next encoding Bluefish will try. This is also the encoding Bluefish will use for files created by Bluefish (UTF-8 by default).

If these steps fail, Bluefish will simply try every encoding defined in the Bluefish config file.

Filenames on disk can also contain non ASCII characters. All GNOME and GTK programs (including Bluefish) assume that filenames are in UTF-8 encoding. If you have filenames in the encoding of your locale on your disk, you have to set G_BROKEN_FILENAMES=1 in the environment to make GNOME and GTK programs detect this encoding.

For information about writing documents in 16-bits encoded languages, such as Japanese, see Section 9.3, “Input methods”.

12.3. Open advanced

You can open multiple files at once with the File → Open Advanced... (Shift+Ctrl+O) menu item from a directory based on their extension or their contents. The same functionality is available from the file browser in the side panel by right-clicking a directory. This feature is available only when the find and grep utilities are installed on your system.

To open all files by extension, enter the extension in the dialog, and leave the search pattern empty. Check the recursive option if you want to include all subdirectories in the search. To open files by content, leave the extension at *, and enter a search pattern in the dialog. You can use regular expression patterns if you check the Is regex option.

You may also combine both methods. Here we open recursively all Chinese XML files in a given tree, whose contents contain the word packaging.

Using the Open Advanced Dialog