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.

Bug 241490

Summary: Provide a way to display ASCII BLOB content
Product: db Reporter: twolf2919 <twolf2919>
Component: Show DataAssignee: 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
We use BLOBS to store XML (and other) data and it would be really useful if DB Explorer could display this information.  Currently there is already a "Display as Image..." - maybe a "Display as Text..." could be added?  Alternatively, maybe the explorer could auto-detect that the content of a BLOB is all ASCII/UTF-8 and display it this way in the cell.
Comment 1 matthias42 2014-02-08 18:14:23 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 :-)
Comment 2 matthias42 2014-04-13 21:00:59 UTC
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.
Comment 3 markiewb 2014-07-09 21:42:28 UTC
@NB-Dev: Please review the patch.
Comment 4 Libor Fischmeistr 2014-07-10 09:59:32 UTC
Patch applied - http://hg.netbeans.org/core-main/rev/df44f80d9a79

Thanks Matthias for it.
Comment 5 Quality Engineering 2014-07-19 10:18:59 UTC
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
Comment 6 matthias42 2014-07-19 15:11:28 UTC
Thank you!