Accept codeset 1 (undefined) as 106 (UTF-8) when pasting from the

clipboard.  This should allow us to at least paste from broken ports of
MorphOS apps.

svn path=/trunk/netsurf/; revision=13404
This commit is contained in:
Chris Young 2012-01-15 15:58:26 +00:00
parent efa55dd3f1
commit 676cb962ce
1 changed files with 5 additions and 2 deletions

View File

@ -111,6 +111,7 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
struct ContextNode *cn;
ULONG rlen=0,error;
struct CSet cset;
LONG codeset = 0;
char *clip;
STRPTR readbuf = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR);
@ -131,13 +132,15 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
if((cn)&&(cn->cn_Type == ID_FTXT)&&(cn->cn_ID == ID_CSET))
{
rlen = ReadChunkBytes(iffh,&cset,24);
if(cset.CodeSet == 1) codeset = 106;
else codeset = cset.CodeSet;
}
if((cn)&&(cn->cn_Type == ID_FTXT)&&(cn->cn_ID == ID_CHRS))
{
while((rlen = ReadChunkBytes(iffh,readbuf,1024)) > 0)
{
if(cset.CodeSet == 0)
if(codeset == 0)
{
utf8_from_local_encoding(readbuf,rlen,&clip);
}
@ -145,7 +148,7 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
{
utf8_from_enc(readbuf,
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
cset.CodeSet, DFCS_MIMENAME),
codeset, DFCS_MIMENAME),
rlen, &clip);
}