Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| files:encoding [2015/01/21 01:34] – [How to set default encoding for specific syntax] admin | files:encoding [2018/10/04 17:14] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Preconditions ===== | ===== Preconditions ===== | ||
| - | - File can have one encoding (same as code page). Encoding can be as unicode | + | - The file can have one encoding (same as code page). Encoding can be Unicode |
| - There are several places, where encoding conversion can be applied to document: Open, Save As, New, Search and Replace | - There are several places, where encoding conversion can be applied to document: Open, Save As, New, Search and Replace | ||
| - | - The encoding can be selected/ | + | - The encoding can be selected/ |
| - | - If encoding for document once changed by user, this preference has priority over all the rest of settings. Preferences | + | - If encoding for document once changed by the user, this preference has priority over all the rest of settings. Preferences |
| So, how all this works together (or designed to work ) : | So, how all this works together (or designed to work ) : | ||
| ===== New File ==== | ===== New File ==== | ||
| - | For the new File encoding selection (if setting is not defined, or set to Automatic next taken). | + | For the new File encoding selection (if the setting is not defined, or set to Automatic next taken). |
| * Syntax force encoding | * Syntax force encoding | ||
| * Current Project settings encoding | * Current Project settings encoding | ||
| Line 22: | Line 22: | ||
| * Syntax force encoding | * Syntax force encoding | ||
| * Encoding selected in File Open dialog | * Encoding selected in File Open dialog | ||
| - | * Auto-detected encoding with usage of all algorithms mentioned above. Set of applied algorithms can be changed in settings.xml | + | * Auto-detected encoding with the usage of all algorithms mentioned above. Set of applied algorithms can be changed in settings.xml |
| * Syntax preferred encoding | * Syntax preferred encoding | ||
| * Project settings encoding taken | * Project settings encoding taken | ||
| Line 32: | Line 32: | ||
| * Encoding selected in File Save dialog | * Encoding selected in File Save dialog | ||
| * Current document encoding | * Current document encoding | ||
| - | * During save, HippoEDIT checks | + | * During save, HippoEDIT checks |
| - | * Because HippoEDIT internally works with Unicode representation of text (UTF16 LE), on save, can happen that current text could not be saved without | + | * Because HippoEDIT internally works with Unicode representation of text (UTF16 LE), on saving, can happen that current text could not be saved without |
| ===== Search and Replace ===== | ===== Search and Replace ===== | ||
| - | Search and Replace encoding uses same logic as for Open/Save file, just interactive selection of encoding, with Open/Save dialog, not available. | + | Search and Replace encoding uses same logic as for Open/Save file, but interactive selection of encoding, with Open/Save dialog, not available. |
| ===== If there are problems ===== | ===== If there are problems ===== | ||
| So, if you see that documents are open with wrong encoding, you have several choices of how to solve this: | So, if you see that documents are open with wrong encoding, you have several choices of how to solve this: | ||
| - | | + | |
| - | | + | |
| - | <code xml> | + | |
| - | < | + | |
| - | </ | + | |
| - | in SPECIFICATION section of schema spec file. | + | |
| - | | + | |
| It can be done with xml flags in settings.xml, | It can be done with xml flags in settings.xml, | ||
| <code xml> | <code xml> | ||
| Line 53: | Line 49: | ||
| </ | </ | ||
| - | Also from now on, extended encoding detection is enabled by default only for syntaxes inherited from deftext (as Plain Text, XML and HTML). | + | Also from now on, extended encoding detection is enabled by default only for syntaxes inherited from //deftext// (as Plain Text, XML, and HTML). |
| You can control encoding even in more granular way by disabling some encoding detection methods, which in most cases do not provide false positives. As: | You can control encoding even in more granular way by disabling some encoding detection methods, which in most cases do not provide false positives. As: | ||
| + | * **extended** - heuristically based detection of encoding | ||
| + | * **min_confidence** - minimal confidence level for extendede decoding, default is 90, maybe higher than 100 | ||
| * **bom** (default //true//) - use BOM signs for for encoding detection | * **bom** (default //true//) - use BOM signs for for encoding detection | ||
| * **unicode** (default //true//) - use UTF16 (LE/BE) statistic detection logic in addition to BOM detection (if BOM is not defined) | * **unicode** (default //true//) - use UTF16 (LE/BE) statistic detection logic in addition to BOM detection (if BOM is not defined) | ||
| Line 61: | Line 59: | ||
| * **utf8** (default //true//) - use extended algorithms for UTF8 detection in addition to BOM detection (if BOM is not defined) | * **utf8** (default //true//) - use extended algorithms for UTF8 detection in addition to BOM detection (if BOM is not defined) | ||
| <code xml> | <code xml> | ||
| - | < | + | < |
| </ | </ | ||
| ===== How to set default encoding for specific syntax ===== | ===== How to set default encoding for specific syntax ===== | ||
| Line 73: | Line 71: | ||
| </ | </ | ||
| - | There are two parts of logic you can influence by changing [[syntax:specification|syntax schema]]: | + | More info can be found in [[syntax: |
| + | |||
| + | There are two parts of logic you can influence by changing [[terms:syntax-schema|syntax schema]]: | ||
| ==== Encoding for Syntax ==== | ==== Encoding for Syntax ==== | ||
| - | if you set default encoding for syntax (attribute default), you give a hint to HE, that if none of detection | + | if you set default encoding for syntax (attribute default), you give a hint to HE, that if none of the detection |
| <code xml> | <code xml> | ||
| < | < | ||
| Line 83: | Line 83: | ||
| ==== Force default encoding ==== | ==== Force default encoding ==== | ||
| - | If, in your case automatic detection of encoding often makes mistakes, and determines wrong encoding, you can as globally disable encoding determination as instruct HE to not use automatic detection for specific syntax. | + | If in your case, automatic detection of encoding often makes mistakes and determines wrong encoding, you can as globally disable encoding determination as instruct HE to not use automatic detection for specific syntax. |
| - | To disable HE encoding auto detection for syntax you need to extend previously described definition of default encoding with force flag: | + | To disable HE encoding auto-detection for syntax you need to extend previously described definition of default encoding with force flag: |
| <code xml> | <code xml> | ||
| < | < | ||
| </ | </ | ||
| - | If such settings exist in schema, HE will never auto detect encoding and always will use specified encoding for documents with this [[terms: | + | If such settings exist in the schema, HE will never auto detect encoding and always will use specified encoding for documents with this [[terms: |
| Doing of changes to [[terms: | Doing of changes to [[terms: | ||
| - | Safest | + | The safest |