Commit 14417e0ee8e9d051a74d3e58e27e837908456700
1 parent
2b12bc46
Exists in
master
and in
5 other branches
Corrigindo erro de charset no plugin ooRexx
Showing
6 changed files
with
32 additions
and
99 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -416,7 +416,6 @@ |
416 | 416 | <Unit filename="src/plugins/rx3270/sample/clipboard.rex" /> |
417 | 417 | <Unit filename="src/plugins/rx3270/sample/object.rex" /> |
418 | 418 | <Unit filename="src/plugins/rx3270/sample/remote.rex" /> |
419 | - <Unit filename="src/plugins/rx3270/text.cc" /> | |
420 | 419 | <Unit filename="src/plugins/rx3270/typed_routines.cc" /> |
421 | 420 | <Unit filename="src/pw3270/Makefile.in" /> |
422 | 421 | <Unit filename="src/pw3270/actions.c"> | ... | ... |
src/classlib/session.cc
... | ... | @@ -472,10 +472,28 @@ |
472 | 472 | } |
473 | 473 | else |
474 | 474 | { |
475 | - rc = str; | |
475 | + char * text = strdup(str); | |
476 | + for(char *ptr = text;*ptr;ptr++) | |
477 | + { | |
478 | + if(*ptr < ' ' || *ptr > 128) | |
479 | + { | |
480 | + *ptr = '?'; | |
481 | + } | |
482 | + } | |
483 | + rc = text; | |
484 | + free(text); | |
476 | 485 | } |
477 | 486 | #else |
478 | - rc = str; | |
487 | + char * text = strdup(str); | |
488 | + for(char *ptr = text;*ptr;ptr++) | |
489 | + { | |
490 | + if(*ptr < ' ' || *ptr > 128) | |
491 | + { | |
492 | + *ptr = '?'; | |
493 | + } | |
494 | + } | |
495 | + rc = text; | |
496 | + free(text); | |
479 | 497 | #endif // HAVE_ICONV |
480 | 498 | |
481 | 499 | return rc; | ... | ... |
src/lib3270/iocalls.c
src/plugins/rx3270/pluginmain.cc
src/plugins/rx3270/text.cc
... | ... | @@ -1,95 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
20 | - * | |
21 | - * Este programa está nomeado como text.cc e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - */ | |
29 | - | |
30 | - #include "rx3270.h" | |
31 | - #include <lib3270/actions.h> | |
32 | - | |
33 | - #include <string.h> | |
34 | - | |
35 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
36 | - | |
37 | -char * rx3270::get_3270_string(const char *str) | |
38 | -{ | |
39 | -#ifdef HAVE_ICONV | |
40 | - if(conv2Host != (iconv_t)(-1)) | |
41 | - { | |
42 | - size_t in = strlen((char *) str); | |
43 | - size_t out = (in << 1); | |
44 | - char *ptr; | |
45 | - char *buffer = (char *) malloc(out); | |
46 | - char *ret; | |
47 | - | |
48 | - memset(ptr=buffer,0,out); | |
49 | - | |
50 | - iconv(conv2Host,NULL,NULL,NULL,NULL); // Reset state | |
51 | - | |
52 | - if(iconv(conv2Host,(ICONV_CONST char **) &str,&in,&ptr,&out) == ((size_t) -1)) | |
53 | - ret = strdup((char *) str); | |
54 | - else | |
55 | - ret = strdup(buffer); | |
56 | - | |
57 | - free(buffer); | |
58 | - | |
59 | - return ret; | |
60 | - } | |
61 | -#endif // HAVE_ICONV | |
62 | - | |
63 | - return strdup(str); | |
64 | -} | |
65 | - | |
66 | -char * rx3270::get_local_string(const char *str) | |
67 | -{ | |
68 | -#ifdef HAVE_ICONV | |
69 | - if(conv2Local != (iconv_t)(-1)) | |
70 | - { | |
71 | - size_t in = strlen((char *) str); | |
72 | - size_t out = (in << 1); | |
73 | - char *ptr; | |
74 | - char *buffer = (char *) malloc(out); | |
75 | - char *ret; | |
76 | - | |
77 | - memset(ptr=buffer,0,out); | |
78 | - | |
79 | - iconv(conv2Local,NULL,NULL,NULL,NULL); // Reset state | |
80 | - | |
81 | - if(iconv(conv2Local,(ICONV_CONST char **) &str,&in,&ptr,&out) == ((size_t) -1)) | |
82 | - ret = strdup((char *) str); | |
83 | - else | |
84 | - ret = strdup(buffer); | |
85 | - | |
86 | - free(buffer); | |
87 | - | |
88 | - return ret; | |
89 | - } | |
90 | -#endif // HAVE_ICONV | |
91 | - | |
92 | - return strdup(str); | |
93 | -} | |
94 | - | |
95 | - |
src/pw3270/trace.c
... | ... | @@ -418,7 +418,15 @@ static void destroy(GtkObject *widget) |
418 | 418 | gtk_text_buffer_get_end_iter(hwnd->text,&itr); |
419 | 419 | |
420 | 420 | msg = g_strdup_vprintf(fmt,args); |
421 | - gtk_text_buffer_insert(hwnd->text,&itr,msg,strlen(msg)); | |
421 | + | |
422 | + if(g_utf8_validate(msg,strlen(msg),NULL)) | |
423 | + { | |
424 | + gtk_text_buffer_insert(hwnd->text,&itr,msg,strlen(msg)); | |
425 | + } | |
426 | + else | |
427 | + { | |
428 | + gtk_text_buffer_insert(hwnd->text,&itr,"** Invalid UTF8 String **",-1); | |
429 | + } | |
422 | 430 | g_free(msg); |
423 | 431 | |
424 | 432 | gtk_text_buffer_get_end_iter(hwnd->text,&itr); | ... | ... |