google-code-export / lightlang

Automatically exported from code.google.com/p/lightlang
0 stars 0 forks source link

Google translate - converting hexadecimal character codes and new line #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have done some research about this problem. I am not familiar with 
Python, but it's rather similar to Perl. The code was done by reading 
Python's manual so my code is rather "hacky" (not good), and the solution 
may be not optimized or clean:

GoogleTranslate.py

http://pastebin.com/maed7f40

Original issue reported on code.google.com by rusv...@gmail.com on 19 Nov 2009 at 8:35

GoogleCodeExporter commented 9 years ago
About output result with new line break, I think what if the input string is 
split 
to list of lines and send each "line" to server?

Modified in converting hex code:
http://pastebin.com/m222e664a

Original comment by rusv...@gmail.com on 20 Nov 2009 at 6:58

GoogleCodeExporter commented 9 years ago
haaackk... :-) I think what can i do

Original comment by mdevaev@gmail.com on 21 Nov 2009 at 9:46

GoogleCodeExporter commented 9 years ago
hacky... I meant it's not the good way (as I learnt this word from Internet). :)

And don't get me wrong :) . I just do something when wait you solve the problem 
(hey, how Python dummy (I know nothing) can teach Python programmer what he can 
do, 
right??) :D

Original comment by rusv...@gmail.com on 21 Nov 2009 at 4:34

GoogleCodeExporter commented 9 years ago
:-)))

Original comment by mdevaev@gmail.com on 22 Nov 2009 at 12:02

GoogleCodeExporter commented 9 years ago
Maybe fixed, check it please

Original comment by mdevaev@gmail.com on 24 Nov 2009 at 9:19

GoogleCodeExporter commented 9 years ago
I replaced "\n" symbols to "<br>" :-)

Original comment by mdevaev@gmail.com on 24 Nov 2009 at 9:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
If use tag <br>, the problem is that \u003cbr\u003c must be converted to <br>, 
but 
also, \u003c will be convert to '<' too. And the program recognize it as the 
beginning of a tag.

example:

input:
"one < two"

result:

"one"

Convert to HTML code could solve this problem but NOT the new line problem.

such as, \u003c --> < but <br< is useless now.

Original comment by rusv...@gmail.com on 25 Nov 2009 at 11:54

GoogleCodeExporter commented 9 years ago
Fuf, check now, please :-)

Original comment by mdevaev@gmail.com on 13 Dec 2009 at 12:58

GoogleCodeExporter commented 9 years ago
It works! :D

Original comment by rusv...@gmail.com on 13 Dec 2009 at 6:40

GoogleCodeExporter commented 9 years ago
Oh, cool :-))

Original comment by mdevaev@gmail.com on 13 Dec 2009 at 6:43