all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: How to save a file with embedded unicode maths symbols
       [not found] <e68aa1ba-3e40-4d3d-b037-9c9560a257b5@googlegroups.com>
@ 2020-03-09 13:14 ` Pieter van Oostrum
       [not found]   ` <mailman.2329.1583759953.2412.help-gnu-emacs@gnu.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Pieter van Oostrum @ 2020-03-09 13:14 UTC (permalink / raw)
  To: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> If I go to this page: https://stackify.com/solid-design-liskov-substitution-principle/
>
> There is a definition of the principle Let Φ(x) ... and I can paste that
> into emacs on Windows and I see the greek symbol displayed just fine.
>
> But When I go to save the file it prompts for a coding system (1st entry
> in list being chinese-iso-8bit). What coding system would I choose to be
> able to save the symbol to disk. My operating system is 64 bit Windows
> 7.

You can save in any encoding that is able to encode all the characters in the file. But generally the best (most useful, universal) encoding is utf-8.

However it depends on what you want to do afterwards with the file. The programs that you use to process the file must be able to understand that encoding. Nowadays most software understands utf-8.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
       [not found]     ` <dfb30828-24b0-47d0-bcbb-7e732b29e22e@googlegroups.com>
@ 2020-03-09 16:27       ` Pieter van Oostrum
       [not found]         ` <mailman.2341.1583771249.2412.help-gnu-emacs@gnu.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Pieter van Oostrum @ 2020-03-09 16:27 UTC (permalink / raw)
  To: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> On Monday, March 9, 2020 at 1:19:16 PM UTC, Pieter van Oostrum wrote:
>> Angus Comber <***@**.c*> writes:
>> 
>> > If I go to this page: https://stackify.com/solid-design-liskov-substitution-principle/
>> >
>> > There is a definition of the principle Let Φ(x) ... and I can paste that
>> > into emacs on Windows and I see the greek symbol displayed just fine.
>> >
>> > But When I go to save the file it prompts for a coding system (1st entry
>> > in list being chinese-iso-8bit). What coding system would I choose to be
>> > able to save the symbol to disk. My operating system is 64 bit Windows
>> > 7.
>> 
>> You can save in any encoding that is able to encode all the characters
>> in the file. But generally the best (most useful, universal) encoding
>> is utf-8.
>> 
>> However it depends on what you want to do afterwards with the file.
>> The programs that you use to process the file must be able to
>> understand that encoding. Nowadays most software understands utf-8.
>> -- 
>> Pieter van Oostrum
>> www: http://pieter.
>> PGP key: [8DAE142BE17999C4]
>
> If I save as filename LSP.txt and select utf-8 it saves without
> complaining but when I open the file again I see:
>
> Let Φ(x) be a property provable about objects x of type T. Then Φ(y)
> should be true for objects y of type S where S is a subtype of T.
>
> ie the phi has transformed to Φ.
>
Did you open it in Emacs?
What you see is the utf-8 encoding of Φ interpreted on reading as latin-1 (iso-8859-1) or a similar encoding, like Windows-1252. Is your Emacs configured to prefer one of these encodings?

-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
       [not found]           ` <5e13d072-68da-4d3b-a62f-e48c0543b0f9@googlegroups.com>
@ 2020-03-10 10:43             ` Pieter van Oostrum
  2020-03-10 13:03               ` Stefan Monnier
  2020-03-10 14:43               ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Pieter van Oostrum @ 2020-03-10 10:43 UTC (permalink / raw)
  To: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> On Monday, March 9, 2020 at 4:27:32 PM UTC, Pieter van Oostrum wrote:
[...]
>> Did you open it in Emacs?
>> What you see is the utf-8 encoding of Φ interpreted on reading as
>> latin-1 (iso-8859-1) or a similar encoding, like Windows-1252. Is your
>> Emacs configured to prefer one of these encodings?

> I have:
>
> GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
>  of 2019-04-13
>
> I have not made any specific encoding config changes as far as I am aware.
>
> Yes I opened the file in emacs.
>
> Is there an emacs option to switch to utf-8 encoding when I view the file?

Yes. You can use  C-x RET c (universal-coding-system-argument), then specify utf-8, and the give the command to open the file (like C-x C-f).

If you regularly work with utf-8 files (something I would recommend) then it is easier to set utf-8 as your preferred encoding. As it seems this is currently not the case, check your LANG environment variable or related ones. It may specify something that causes latin-1 or so to be the default encoding. As you experience, latin-1 or even Windows-1252 (which is an extension of latin-1) are not sufficient for today's international/scientific environment. More specifically, it cannot encode the Φ.

You can find more information in the Emacs info file: (info "(emacs) Language Environments")
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
  2020-03-10 10:43             ` Pieter van Oostrum
@ 2020-03-10 13:03               ` Stefan Monnier
  2020-03-10 14:45                 ` Eli Zaretskii
  2020-03-10 14:43               ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2020-03-10 13:03 UTC (permalink / raw)
  To: help-gnu-emacs

>>> What you see is the utf-8 encoding of Φ interpreted on reading as
>>> latin-1 (iso-8859-1) or a similar encoding, like Windows-1252. Is your
>>> Emacs configured to prefer one of these encodings?
>> I have not made any specific encoding config changes as far as I am aware.
>> Yes I opened the file in emacs.

Hmm... nowadays, Emacs should use utf-8 by default when possible
(i.e. if it is a valid utf-8 encoding, then we should assume that it is
indeed utf-8).  AFAIK that's already the case in the default config.

What happens if you open the file in an Emacs with none of your personal
config changes?  E.g. with `emacs -Q <thefile>`?


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
  2020-03-10 10:43             ` Pieter van Oostrum
  2020-03-10 13:03               ` Stefan Monnier
@ 2020-03-10 14:43               ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-03-10 14:43 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Pieter van Oostrum <pieter-l@vanoostrum.org>
> Date: Tue, 10 Mar 2020 11:43:26 +0100
> 
> > I have:
> >
> > GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
> >  of 2019-04-13
> >
> > I have not made any specific encoding config changes as far as I am aware.
> >
> > Yes I opened the file in emacs.
> >
> > Is there an emacs option to switch to utf-8 encoding when I view the file?
> 
> Yes. You can use  C-x RET c (universal-coding-system-argument), then specify utf-8, and the give the command to open the file (like C-x C-f).
> 
> If you regularly work with utf-8 files (something I would recommend) then it is easier to set utf-8 as your preferred encoding. As it seems this is currently not the case, check your LANG environment variable or related ones. It may specify something that causes latin-1 or so to be the default encoding. As you experience, latin-1 or even Windows-1252 (which is an extension of latin-1) are not sufficient for today's international/scientific environment. More specifically, it cannot encode the Φ.

Since the OP is on Windows, the LANG variable cannot possibly help
(it's unset on Windows, and you cannot set to anything whose codeset
is UTF-8 anyway), and making UTF-8 the preferred encoding is not
recommended.  Instead, I suggest using file-local variables or coding
cookie (or .dir-locals.el, if this should hold for more than a couple
of files in the same directory).



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
  2020-03-10 13:03               ` Stefan Monnier
@ 2020-03-10 14:45                 ` Eli Zaretskii
  2020-03-10 14:54                   ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2020-03-10 14:45 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 10 Mar 2020 09:03:45 -0400
> 
> Hmm... nowadays, Emacs should use utf-8 by default when possible
> (i.e. if it is a valid utf-8 encoding, then we should assume that it is
> indeed utf-8).  AFAIK that's already the case in the default config.

Are you sure?  I don't think we've changed anything in this department
lately.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
  2020-03-10 14:45                 ` Eli Zaretskii
@ 2020-03-10 14:54                   ` Stefan Monnier
  2020-03-10 15:14                     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2020-03-10 14:54 UTC (permalink / raw)
  To: help-gnu-emacs

> Are you sure?  I don't think we've changed anything in this department lately.

Indeed, I think it's been the case for quite a while now.
Tho maybe it depends on the OS or other details of the environment like
the locale.



        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to save a file with embedded unicode maths symbols
  2020-03-10 14:54                   ` Stefan Monnier
@ 2020-03-10 15:14                     ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2020-03-10 15:14 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 10 Mar 2020 10:54:15 -0400
> 
> > Are you sure?  I don't think we've changed anything in this department lately.
> 
> Indeed, I think it's been the case for quite a while now.
> Tho maybe it depends on the OS or other details of the environment like
> the locale.

Well, if the locale says UTF-8, then of course Emacs should prefer
that...



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-10 15:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <e68aa1ba-3e40-4d3d-b037-9c9560a257b5@googlegroups.com>
2020-03-09 13:14 ` How to save a file with embedded unicode maths symbols Pieter van Oostrum
     [not found]   ` <mailman.2329.1583759953.2412.help-gnu-emacs@gnu.org>
     [not found]     ` <dfb30828-24b0-47d0-bcbb-7e732b29e22e@googlegroups.com>
2020-03-09 16:27       ` Pieter van Oostrum
     [not found]         ` <mailman.2341.1583771249.2412.help-gnu-emacs@gnu.org>
     [not found]           ` <5e13d072-68da-4d3b-a62f-e48c0543b0f9@googlegroups.com>
2020-03-10 10:43             ` Pieter van Oostrum
2020-03-10 13:03               ` Stefan Monnier
2020-03-10 14:45                 ` Eli Zaretskii
2020-03-10 14:54                   ` Stefan Monnier
2020-03-10 15:14                     ` Eli Zaretskii
2020-03-10 14:43               ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.