Type | Bug | Status | reviewed | Date | 10-Mar-2010 08:23 |
---|---|---|---|---|---|
Version | alpha 97 | Category | Datatype | Submitted by | sqlab |
Platform | All | Severity | minor | Priority | normal |
Summary | to string! can cause information change and information loss |
---|---|
Description |
to string! (and to-string) changes #{0D} to #{0A} and reduces #{0D0A} to #{0A} |
Example code |
>> to-string to-binary "^M" == "^/" >> to-binary to-string #{0D} == #{0A} >> to-string to-binary "^M^/" == "^/" >> to-binary to-string #{0D0A} == #{0A} |
Assigned to | n/a | Fixed in | - | Last Update | 22-Sep-2010 04:39 |
---|
Comments | |
---|---|
(0002083)
meijeru 10-Mar-2010 08:42 |
This is a feature, as far as I know. |
(0002084)
sqlab 10-Mar-2010 09:18 |
If I want to change line terminators, I can use enline and deline. There is no string conversion without changing the line terminators |
(0002088)
BrianH 11-Mar-2010 19:07 |
I'm inclined to say that this is not a bug.
REBOL strings use "^/" as a line terminator internally. When you convert to REBOL strings, you convert to REBOL internal line termination. All of the REBOL functions that deal with strings expect REBOL line termination. Other line termination standards are an external matter, handled by the conversion routines that are used to format the strings in binary: WRITE if you want something platform-specific, TO-BINARY if you don't. And use DELINE and ENLINE if you need to work around this (though see #601). If you want binary information conserved then work in binary; don't convert to string. This will save you from the invalid UTF character conversion as well. |
Date | User | Field | Action | Change |
---|---|---|---|---|
22-Sep-2010 04:39 | carl | Description | Modified | - |
22-Sep-2010 04:39 | carl | Code | Modified | - |
22-Sep-2010 04:39 | carl | Status | Modified | submitted => reviewed |
11-Mar-2010 19:19 | BrianH | Comment : 0002088 | Modified | - |
11-Mar-2010 19:14 | BrianH | Comment : 0002088 | Modified | - |
11-Mar-2010 19:07 | BrianH | Comment : 0002088 | Added | - |
10-Mar-2010 09:23 | sqlab | Comment : 0002084 | Modified | - |
10-Mar-2010 09:18 | sqlab | Comment : 0002084 | Added | - |
10-Mar-2010 08:42 | meijeru | Comment : 0002083 | Added | - |
10-Mar-2010 08:23 | sqlab | Ticket | Added | - |