Re: XPCE process invocation and character encoding
j.wielemaker <[email protected]> Sat, 28 Jun 2014 11:24:21 +0200
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Dunno. Which OS? Environment? Might also be a bug. I'd consider using process_create/3 and friends. In fact, although xpce will be around for quite a while, it should be considered end-of-life. I think that web-based is the future for interactive Prolog applications. Cheers --- [email protected] wrote:Dear All, I am writing a XPCE based GUI for swish-e which I will release as free software, but I am having problems passing latin characters to a process using this code (from Jan's XPCE userguide): call_unix(Utl, Args, Output) :- NewTerm =.. [process, Utl | Args], new(P, NewTerm), %send(P, environment, 'LANG', 'es_VE.UTF-8'), %send(P, environment, 'LANGUAGE', 'es_VE:es'), send(P, use_tty, @off), new(OS, string), send(P, record_separator, @nil), send(P, input_message, message(OS, append, @arg1)), send(P, open), send(P, wait), pce_string_to_list(OS, Output), send(P, done), send(OS, done). The problem can be seen in the following traces of the tests: test_swish1 :- shell('swish-e -w "Asociación de Profesores del Instituto Pedagógico de Caracas UPEL"', L). which uses the shell directly, and test_swish2 :- call_unix('swish-e', ['-w' ,'Asociación de Profesores del Instituto Pedagógico de Caracas UPEL'], Output), name(A, Output), writeln(A). the first gives the right answer: ?- cea:test_swish1. # SWISH format: 2.4.7 # Search words: Asociación de Profesores del Instituto Pedagógico de Caracas UPEL # Removed stopwords: # Number of hits: 11 # Search time: 0,073 seconds # Run time: 0,092 seconds 1000 ./pdfs/v8n25/articulo14.pdf "articulo14.pdf" 334273 946 ./pdfs/v13n46/articulo28.pdf "articulo28.pdf" 734363 920 ./pdfs/v11n38/articulo18.pdf "articulo18.pdf" 512974 907 ./pdfs/v10n32/articulo21.pdf "articulo21.pdf" 373669 901 ./pdfs/v5n13/articulo5-13-5.pdf "articulo5-13-5.pdf" 193489 898 ./pdfs/v13n46/articulo10.pdf "articulo10.pdf" 1349930 888 ./pdfs/v12n42/articulo16.pdf "articulo16.pdf" 1030090 863 ./pdfs/v13n44/articulo17.pdf "articulo17.pdf" 415354 799 ./pdfs/v13n46/articulo3.pdf "articulo3.pdf" 1036807 739 ./pdfs/v13n44/articulo14.pdf "articulo14.pdf" 400571 504 ./pdfs/v4n11/articulo4-11-14d.pdf "articulo4-11-14d.pdf" 27258 . true. but the second does not: ?- cea:test_swish2. # SWISH format: 2.4.7 # Search words: Asociación de Profesores del Instituto Pedagógico de Caracas UPEL # Removed stopwords: err: no results . true. I am pretty sure the problem is that the process is not receiving those "ó" with the proper encoding. But I don't see how to change that behaviour. As you can see in the comments in the first code, I tried setting the locale environment variables. I didn't work. Any hint? Best regards, Jacinto -- Jacinto A. Dávila. http://webdelprofesor.ula.ve/ingenieria/jacinto/ Universidad de los Andes, Venezuela. _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog -------------- next part -------------- HTML attachment scrubbed and removed _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog