unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Bruce Korb <bkorb@gnu.org>
Cc: guile-devel Development <guile-devel@gnu.org>
Subject: Re: Program received signal SIGSEGV, Segmentation fault.
Date: Fri, 16 Nov 2012 23:22:22 -0500	[thread overview]
Message-ID: <876254svsx.fsf@tines.lan> (raw)
In-Reply-To: <50A6CD05.3010706@gnu.org> (Bruce Korb's message of "Fri, 16 Nov 2012 15:32:21 -0800")

Bruce Korb <bkorb@gnu.org> writes:
> On 11/16/12 13:23, Mark H Weaver wrote:
>>> Actually, it was scm_from_utf8_string, since GUILE_VERSION was 200005
>> 
>> Okay, that's the problem.  You told Guile that the C string was encoded
>> in UTF-8, but actually it was encoded in Latin-1:
>
> OK, so I tried latin1, too.  (replacing scm_from_utf3_string with
> scm_from_latin1_string).  That also does not work.  It replaced the
> 0xA9 character with '?'.

I think what happened is that the scm_from_latin_string *did* work, but
printing did not work.  That's because when the locale is set to "C",
that means ASCII-only, so it was unable to print the copyright symbol.

> What it all boils down to is that I am looking for string handling
> functions that will handle the NUL terminated list of bytes and keep
> its nose out of the contents of the string.  Period.  Full stop.

Bruce, if you refuse to fix these problems properly, you will end up
with a broken program.  Period.  Full stop.  Most modern distributions
use UTF-8 by default, and if you simply write a bare 0xA9 to the
terminal or output file, that's not going to look right on their
terminal or editor.

But if that's really what you want, fine, here's how you do it:

  (fluid-set! %default-port-encoding "ISO-8859-1")
  (set-port-encoding! (current-output-port) "ISO-8859-1")
  (set-port-encoding! (current-input-port) "ISO-8859-1")
  (set-port-encoding! (current-error-port) "ISO-8859-1")

and make sure to *not* set the locale.

     Mark



  parent reply	other threads:[~2012-11-17  4:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 18:00 Program received signal SIGSEGV, Segmentation fault Bruce Korb
2012-11-16 19:19 ` Mark H Weaver
2012-11-16 19:50   ` Bruce Korb
2012-11-16 20:20     ` Bruce Korb
2012-11-16 21:23       ` Mark H Weaver
2012-11-16 23:32         ` Bruce Korb
2012-11-17  2:19           ` Noah Lavine
2012-11-17 20:22             ` Bruce Korb
2012-11-17  4:22           ` Mark H Weaver [this message]
2012-11-17 18:12             ` Bruce Korb
2012-11-17 19:56               ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=876254svsx.fsf@tines.lan \
    --to=mhw@netris.org \
    --cc=bkorb@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).