#982 (ok 4.3) Support for editing binary fields in hexadecimal


tbl_change.php currently contains the following note:
// We don't want binary data to be destroyed
// Note: from the MySQL manual: "BINARY doesn't affect how the column is
// stored or retrieved" so it does not mean that the contents is
// binary

The problem is that binary fields are byte arrays rather than strings. Using binary fields instead of textual fields is a bad practicle because there is high chance that the data will be displayed incorrectly or data loss will occur.

There is no problem for SBCS (single byte character set) encodings because the byte-to-character mapping is a 1-to-1 mapping. MBCS (multi byte character set) encodings on the other hand can map some characters to a byte squence longer than one byte. The data loss can occur (at a very high probability with MBCS encodings) because proper decoder implementations has to filter out invalid byte sequences and when the data is converted back to a byte array, these invalid byte sequences are lost.

I usually use binary fields to store password hashes and small image files.

This problem not only affects East Asian languages but UTF-8 as well. And because UTF-8 is widely used by now some solution is necessary.

A very obvious solution is to modify the user interface to edit binary fields in hexadecimal.

Note that phpMyAdmin already has support for exoprting binary fields in hexadecimal and that is the default settings.

I believe that binary fields are intended to store binary (non-textual) data and as such they are better to be edited in hexadecimal.

I suggest to make this behavior default.

And this would render $cfg['ProtectBinary'] unnecessary so removing $cfg['ProtectBinary'] should be considered as well.


  • Marc Delisle

    Marc Delisle - 2014-01-17
    • labels: Interface Improvements --> Interface Improvements, GSOC 2014
    • assigned_to: Isaac Bennetch
    • Group: --> Needs_decision
  • Viduranga Wijesooriya

    Hi Marc,
    I'm having a little trouble understanding this requirement. I will tell how I understood it. Since editing binary fields like strings is bad practice we should avoid editing/inserting strings and then convert to hexadecimal. Rather we should directly input as hexadecimal values. So we need to implement a validation of hexadecimal. Am I right ?

  • Marc Delisle

    Marc Delisle - 2014-03-06

    you are right.

  • Isaac Bennetch

    Isaac Bennetch - 2014-05-21
    • summary: Support for editing binary fields in hexadecimal --> (ok 4.3) Support for editing binary fields in hexadecimal
    • status: open --> pending
    • Priority: 5 --> 1
  • Marc Delisle

    Marc Delisle - 2014-12-05
    • Status: resolved --> fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks