[PD-dev] [ pure-data-Bugs-2501709 ] [any2string] converts non-ascii chars to negative values

SourceForge.net noreply at sourceforge.net
Tue Jan 13 14:46:19 CET 2009


Bugs item #2501709, was opened at 2009-01-12 17:17
Message generated for change (Comment added) made by mukau
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2501709&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: externals
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Roman Haefeli (reduzent)
Assigned to: Nobody/Anonymous (nobody)
Summary: [any2string] converts non-ascii chars to negative values

Initial Comment:
belongs to: moocow/pdstring/any2string

non-ascii characters (such as the umlaute 'äöü') are converted to negative values.

instead of i, [any2string] converts to  i-256, thus the negative values.

[string2any], OTOH, does seem to work correctly. '246' is converted to 'ö'.

this on pd-vanilla linux with: 
pdstring version: 0.06 by Bryan Jurish



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

Comment By: Bryan Jurish (mukau)
Date: 2009-01-13 14:46

Message:
This is known behavior, due to the C type used internally ("char", which in
C semantics means "signed char").

Non-ASCII characters should be accepted by [string2any] in both "signed
char" (ö = -10) and "unsigned char" (ö = 246) format, though.

It would be easy to change [any2string] to output only "unsigned char"
values in the range (0..255) rather than "signed char" values in the range
(-128..127), but I don't yet see any pressing need to do so, since it would
break patches that rely on this behavior (if there are any).

As a workaround, you can use [moses] to detect negative values and [+ 256]
to bash them to values in the (0..255) range if you need to.

-Bryan

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=2501709&group_id=55736




More information about the Pd-dev mailing list