Michael Gerz wrote:
> Peter Kümmel schrieb:
>> http://bugzilla.lyx.org/show_bug.cgi?id=3203:
>>
>>  
>>> Yes, LyX treats all text files as utf8, and iconv can choke on
>>> non-utf8 text
>>> interpreted as utf8. I see the same here.
>>> Since it is not possible to detect the file encoding reliably from
>>> the contents
>>> the only option I see to make this work is to let the user give the
>>> encoding
>>> (e. g. with a combox in the import dialog). The default could be the
>>> locale
>>> encoding or utf8.
>>>     
>>
>>
>> Here an idea to fix this bug for most cases: When the UTF-8 import fails
>> we try to read the file as local-8bit encoded. When this also fails a
>> message box pops up:
>>     The file is neither UTF-8 nor local-8Bit encoded.
>>     To import the file please change its encoding.
>>
>> Is from_local8bit the right choice?
>>
>> Instead of showing the message we could later open an dialog to choose
>> the
>> encoding. But therefore we need a new dialog and  a new conversion
>> function
>> docstring const from_encoding(std::string const & s);
>> Or how is the conversion from an arbitrary encoding done?
>>   
> 
> Is there any way to determine the encoding of a file? Can't any file be
> considered as UTF-8 (even if it is not encoded in UTF-8)?
> 

Georg's comment in bugzilla is

>>> Yes, LyX treats all text files as utf8, and iconv can choke on
>>> non-utf8 text

also

>>> Since it is not possible to detect the file encoding reliably from
>>> the contents


Currently the import of non utf8 files doesn't work because the file
IS considered as utf-8. So I don't see a general way without asking the user.

> Suggestion:
> 
> +                        _("The file is neither UTF-8 nor local-8Bit
> encoded.\nTo import the file please change its encoding."));
>     =>
> +                        _("The file is neither UTF-8-encoded nor local
> 8Bit-encoded.\nTo import the file, please change its encoding."));
> 
> Michael
> 

OK.

-- 
Peter Kümmel

Reply via email to