[drupal-devel] [bug] replace binary strings in node.module with hex encodings

danielc drupal-devel at drupal.org
Wed Jun 1 00:49:45 UTC 2005


Issue status update for http://drupal.org/node/24025

 Project:      Drupal
 Version:      4.6.0
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  danielc
 Updated by:   danielc
 Status:       patch

Steven wrote:
> Keeping them as plain-text is vital to keeping the code readable,
> using hex escapes reduces editability.


Right now, when viewing these characters using readers don't deal with
these characters well,
like Mozilla looking at the web interface of the CVS repository
(go to
http://cvs.drupal.org/viewcvs/drupal/drupal/modules/node.module?annotate=1.493
then look at line 217), I see an a tilde, a Euro symbol, and a comma.  I
hardly consider that "readable."


When viewing the file in vi, the binary data already shows up as their
hex representatives (for example line 217 has "\xe3\x80\x82".  So,
changing them to an escaped/encoded string makes the string look
exactly the same.  The only difference is that my patch represents each
character using four ASCII characters.  Now everyone can easily read and
edit the values.




danielc



Previous comments:
------------------------------------------------------------------------

May 31, 2005 - 15:53 : danielc

Attachment: http://drupal.org/files/issues/node.module.nobinary.diff (864 bytes)

drupal/modules/node.module contains three binary strings.  The use of
binary strings causes problems in text editors incapable of handling
such strings.


For example, I have modified this file for internal use, but when I
save the file, the binary strings get converted to question marks. 
While someone could argue that I should get a better text editor, this
issue exists for many users, not just me.  Better yet, the solution is
simple...


PHP allows representing binary characters via hex encoding.  That's
what this patch does.


Thanks.




------------------------------------------------------------------------

May 31, 2005 - 17:23 : kbahey

+1 for this.


They never show up correctly for me (Linux. vim).




------------------------------------------------------------------------

May 31, 2005 - 18:19 : Steven

All Drupal code is UTF-8 encoded. Locale.inc contains many more such
strings and there's some in search.module too. Keeping them as
plain-text is vital to keeping the code readable, using hex escapes
reduces editability.


-1 on this.




------------------------------------------------------------------------

May 31, 2005 - 18:25 : Steven

PS: If your editor converts them to question marks, it means it doesn't
support UTF-8 properly and only handles your local ANSI codepage. You
will run into many more issues. I use Notepad2 on Windows and it works
like a charm.







More information about the drupal-devel mailing list