Brian McKee wrote:
> On 18-Sep-06, at 11:56 AM, David Morel wrote:
>> Brian McKee a écrit :
>>>>> file Localizable.strings
>>>>> Localizable.strings: Big-endian UTF-16 Unicode C program character
>>>>> data
>>> If I open that file in vim I get
>>> ??^@/[EMAIL PROTECTED]@ [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL
>>> PROTECTED]@ [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL
>>> PROTECTED]@[EMAIL PROTECTED]
>>> but Text Edit displays it correctly.
>>> Can vi handle this type of file? If so, how?
>> in vim, type :h multibyte
>> that should get you started :)
>
> Eeeek - started right around the bend I think :-)
> Biggest issue from my current point of view is it studiously ignores Mac
> OS...
>
> Chris Eidhof suggested
>> set encoding=utf8
>> set fileencoding=utf8
>
> which works if you set it before you open the file in question.
> Interestingly =utf16 'works' too... or at least it shows plain ASCII
> type lettering ok.
>
> Between those ideas I've decided to leave things alone and just do a
> :e ++enc=utf16
> whenever I see lots of alternating @ signs and letters :-)
> I think I'd prefer leaving my standard encoding at latin1 to match the
> linux
> boxes I'm often working on at the same time.
>
> Am I right in understanding that Apple's TextEdit must be automatically
> detecting UTF16 files and changing it's base encoding to match?
>
> And is there some way that vi could do the same?
I'm not seeing this problem (but see below). I can open that file fine, and it
shows everything correctly.
MacOS X 10.4.7
Vim 7.0 with patches 1-76
iTunes 7
I'm getting fileencoding=ucs-2 and encoding=utf-8. I don't touch either option
in ~/.vimrc. However, in ~/.MacOSX/environment.plist, I am setting LANG to
en_US.UTF-8, so I assume that Vim is picking the value of encoding based upon
that.
Assuming that may be involved in things, I tried the following:
LANG=C gvim -RM Localizable.strings
Presto! I see all your @ signs.
Therefore, change your LANG environment variable to include unicode in it.