This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Provide a way to display ASCII BLOB content | ||
---|---|---|---|
Product: | db | Reporter: | twolf2919 <twolf2919> |
Component: | Show Data | Assignee: | Libor Fischmeistr <lfischmeistr> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | joecsc |
Priority: | P3 | Keywords: | PATCH_AVAILABLE |
Version: | 8.0 | ||
Hardware: | PC | ||
OS: | Mac OS X | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: | proposed patch v1 |
Description
twolf2919
2014-02-06 13:37:22 UTC
Autodetecting the "correct" encoding is hard - if not impossible. You can't seperate pure ASCII text from UTF-8 encoded text, that only contains "low range" characters (that map to ASCII). Imaging this: <?xml version="1.0" charset="ISO-8859-15"?> That coding does contain the EUR symbol, encoding this as UTF-8 and saving the content to database basicly destroys the document content, as the codepoint that represents EUR in ISO-8859-15 is most probably not the same as in UTF-8 (i did not check). What is more, you need probably read a lot of the data to guess correctly. From a quick glance: Add a menu entry "Open as Text", the associated action then opens the Blob, read the $random_number bytes and does some basic checks: - Is a BOM present? - Is an XML declaration contained? If one of the above is found, make an educated guess for a "default" charset. If none of the above holds true, use the "default" plattform charset as default (or better UTF8???). After that ask the user to choose encoding. An input window like the CLOB case could be used, with an drop down to change the encoding for saving. This was put down, so that I don't forget it :-) Created attachment 146726 [details]
proposed patch v1
Attached you can find an implementation of the feature. It is basic, but should do the job. For XML derivatives charset encoding is copied from the XML module.
@NB-Dev: Please review the patch. Patch applied - http://hg.netbeans.org/core-main/rev/df44f80d9a79 Thanks Matthias for it. Integrated into 'main-silver', will be available in build *201407190718* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/df44f80d9a79 User: Libor Fischmeistr <lfischmeistr@netbeans.org> Log: #241490: Provide a way to display ASCII BLOB content Thank you! |