Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SExp: parsing the output of the printer produces a different SExp #242

Closed
1 of 5 tasks
JohnReppy opened this issue Jul 16, 2022 · 0 comments
Closed
1 of 5 tasks

SExp: parsing the output of the printer produces a different SExp #242

JohnReppy opened this issue Jul 16, 2022 · 0 comments
Assignees
Labels
bug Something isn't working fixed-in-2022.1 issue is fixed in the 2022.1 release gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib problem with some SML/NJ library

Comments

@JohnReppy
Copy link
Contributor

Version

No response

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

No response

Processor

Any

Component

SML/NJ Library

Severity

Major

Description of the problem

"SExpParser.parse" from the SML/NJ library does not produce the same
s-expression that was written using "SExpPrinter.print" when strings
containing multibyte characters are involved. How to reproduce:

(* 1. Print str. )
val str = "∞"; (
Infinity character. *)
print str;

(* 2. Write str to a file as an s-expression. *)
val out = TextIO.openOut "infinity.txt";
SExpPrinter.print (out, SExp.STRING str);
TextIO.closeOut out;

(* 3. Attempt to read back str from the file. *)
case SExpParser.parseFile "infinity.txt" of
[SExp.STRING str'] => print str'
| _ => ();

In step 1, "∞" is displayed, but in step 3, "\226\136\158" is displayed.

This problem occurs because "SExpPrinter.print" escapes all strings
using "String.toString" but "SExpParser.parseFile" does not unescape
strings using "String.fromString".

Transcript

No response

Expected Behavior

No response

Steps to Reproduce

No response

Additional Information

No response

Email address

No response

Comments from smlnj-gforge

Original smlnj-gforge bug number 309

Submitted on 2022-03-17 at 06:0300

comment by @JohnReppy on 2022-28-31 14:2800 +000 UTC

Fixed for 110.99.3 and 2022.1. The SExp library now uses Scheme syntax for string values.

@JohnReppy JohnReppy added bug Something isn't working gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib problem with some SML/NJ library labels Jul 16, 2022
@JohnReppy JohnReppy self-assigned this Jul 16, 2022
@JohnReppy JohnReppy added the fixed-in-2022.1 issue is fixed in the 2022.1 release label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-in-2022.1 issue is fixed in the 2022.1 release gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib problem with some SML/NJ library
Projects
None yet
Development

No branches or pull requests

1 participant