[OS X TeX] TeXShop 2.14 does not display saved Chinese characters correctly

Maarten Sneep maarten.sneep at xs4all.nl
Thu Dec 6 15:37:46 EST 2007


On 5 dec 2007, at 23:36, Jung-Tsung Shen wrote:

> On 12/5/07, Jung-Tsung Shen <jushen at gmail.com> wrote:
>> On 12/5/07, Herbert Schulz < herbs at wideopenwest.com> wrote:
>>>
>>> Try to make a fresh file starting with a blank document and make  
>>> sure
>>> it has the
>>>
>>> %%!TEX encoding = UTF-8 Unicode
>>>
>>> line before saving it the first time. I've seen problems if I try to
>>> change the encoding once it has been saved.
>>>
>>
>>
>> The line (with double %%) does help to preserve the Chinese  
>> characters when reopened. The encoding method on saving, however,  
>> seem to be ineffective. I would think the encoding method on saving  
>> should do the same trick. Or, this is a way of implementation to  
>> accomplish cross platforms, cross text editors, ... etc?

>

This is a TeXShop specific issue. Allan Odgaard (TextMate) claims that  
from a few bytes of text it is possible to recognise UTF-8, see: http://blog.macromates.com/2005/handling-encodings-utf-8/ 
  .

Of course many still have legacy documents that are pure 8-bit encoded  
files, especially true in the TeX world.

The Cocoa Foundation Framework now includes code to add the string  
encoding to a plain text file as an extended attribute. This already  
works in TextEdit in 10.5, and other editors are sure to follow. Note  
however that this attribute may not survive netoworked transportation  
(i.e. as a mail attachment.

> The situation I am facing now is, to get the characters displayed  
> correctly, I have to include the line (%%!TEX ...) at the beginning  
> of the document. But when I submit the manuscript to the publisher  
> (APS in question), should I include this line as well? Will it cause  
> any other side effect on APS' side? [I know the only way to find out  
> is to ask APS ... but I would appreciate some comments from the  
> point of view of LaTeX.]

Since
%!TEX encoding = UTF-8 Unicode
is just a comment as far as TeX is concerned, there is no harm in  
this. It is human readable, so APS editors can use this as well.

By the way I found out why I had a probem before. I mistyped the  
encoding name (I left out the Unicode part). Apparently this causes  
TeXShop to fall back to some 8-bit encoding, rather than the default  
or whatever it was told to try in the file-open dialog box. I don't  
think it is desirable behaviour, but at least I solved the issue.

Best,

Maarten



More information about the MacOSX-TeX mailing list