diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-04-30 10:54:02 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-04-30 10:54:02 +0000 |
commit | 7fd6597468f70a652c413ab0d4bdc14871ed0cd1 (patch) | |
tree | 7007fa53d2e3887395eafbc0091e15f303c66ec9 /amiga/clipboard.c | |
parent | 1518543c227c61250da14a864ad88c10fc6cd4c4 (diff) | |
download | netsurf-7fd6597468f70a652c413ab0d4bdc14871ed0cd1.tar.gz netsurf-7fd6597468f70a652c413ab0d4bdc14871ed0cd1.tar.bz2 |
Avoid crash if conversion to local charset fails.
Attempt to convert nbsp to normal spaces when converting to local charset for
clipboard
svn path=/trunk/netsurf/; revision=12260
Diffstat (limited to 'amiga/clipboard.c')
-rwxr-xr-x | amiga/clipboard.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/amiga/clipboard.c b/amiga/clipboard.c index bf0b6f618..848c90460 100755 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -221,8 +221,21 @@ bool ami_add_to_clipboard(const char *text, size_t length, bool space) } else { - utf8_to_local_encoding(text,length,&buffer); - if(buffer) WriteChunkBytes(iffh,buffer,strlen(buffer)); + buffer = ami_to_utf8_easy(text); + + if(buffer) + { + char *p; + + p = text; + + while(*p != '\0') + { + if(*p == 0xa0) *p = 0x20; + p++; + } + WriteChunkBytes(iffh, buffer, strlen(buffer)); + } ami_utf8_free(buffer); } |