Forum Moderators: open

Message Too Old, No Replies

Again that Japanese search term problem...

I'd love to script my search term log search and feeling stupid abou it.

         

Josefu

8:53 am on Feb 2, 2004 (gmt 0)

10+ Year Member



It's me again. Thanks for the earlier tip in pasting the search term gobbldeegook resulting from the japanese input that turned up my site into the browser's url bar to see what the user was looking for and where, but...

Is there any way to translate that code into shift-jis? I seem to have missed something. I've already made a nice drop-script which cuts all of the search url's out of my logs, but for the time being I am forced to plod one by one between the resulting list and my browser.

Thanks in advance for any help,

Josefu

takagi

9:05 am on Feb 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you refered to the thread: Extracting Japanese Search Terms from Logs - I can't seem to do it... [webmasterworld.com]

Josefu

9:36 am on Feb 2, 2004 (gmt 0)

10+ Year Member



Yes, I read through it again but am looking for a simpler solution to translate than using many apps - if I understand correctly what goes up there in the bar is UTF-8? I don't have the time to learn CGI script for now - there should be a simpler solution but as usual I think I'm thinking past the problem.

Thanks,

Josefu

kazonik

1:30 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



Do you have access to the command line?

Josefu

2:08 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



I do, sir : )

kazonik

2:42 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



Hmmm...
I have a PHP script I made that does just the thing you need.

I'll see if I can try and wack it into a one line command.

kazonik

2:52 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



It was faster for me to write a script to decode the urlencoding...

I'll sticky you the URL.

Kaz

Josefu

4:32 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



Thanks a million! I'll try it : )

(added) it seems to convert the characters into the the right code, but your page won't switch from western encoding to shift-jis so we can read it.

Thanks for trying - I'd like to know how you did it so that from now on I can do it for myself instead of depending on your site and your kindness. I'm sure it's really simple and I'll be slapping my forehead for days afterwards.

Take care,

Josef.

kazonik

4:50 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



Sticky me your email of you like and I'll send you the PHP script.

Kaz

bill

12:41 am on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless there's a real need to be cloak & dagger about this script, I think a lot of members might benefit from this if you posted it in this thread...

Woz

1:50 am on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree bill, we'll relax the rules on this one if kazonik would like to share.

Onya
Woz

Josefu

7:10 am on Feb 10, 2004 (gmt 0)

10+ Year Member



Well, when I find the answer be sure that I'll post it here. Thanks anyways!

kazonik

5:49 pm on Feb 10, 2004 (gmt 0)

10+ Year Member



Hi everyone,

sorry I was in a really busy spell for the last few days..

here is a very simple PHP script that will url-decode whatever you paste into the text box.

Save it as anything.php and upload to your server.

and give it a try...

I've got some longer, bigger, mega scripts that read directly from the logfile but they sometimes run out of server memory on HUGE logfiles and may cause you heartburn if you dont know what your doing....

hope this is useful enough for now.

------------ COPY BELOW THIS LINE -----------
<?
$text = urldecode($text);
$text = nl2br($text);
?>
<html lang=ja>
<head>
<title>URLDECODE</title>
</head>
<body>
<? echo $text;?>
<center>
<form action="<?php echo $PHP_SELF;?>" method="post" enctype="application/x-www-form-urlencoded">
<textarea name="text" cols="48" rows="10"></textarea><br>
<input type="submit" value="Convert Text" name="convert">
</form>
<br>
</center>
</body>
</html>
------------ COPY ABOVE THIS LINE -----------

Peace:)
Kaz

Josefu

4:22 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



Hey, thanks Kaz - unfortunately it doesn't seem to work for me, as it will only convert to single-spaced hiragana. Nice idea, though it is much the same as pasting it in the URL bar - I need to do reams of text, not line by line... but I'm not one to ask too much : ) Thanks for trying.

kazonik

4:50 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



Hi Josefu,

Here's a similar version that will do an entire file at a time.
1) Save the file that you want to de-code
2) Upload it to your server in the same directory as the script.
3) then call the script in your browser and enter the name of the file (eg. referers.txt)
4) click convert and it should do the trick.

Notes:
a) how big your file can be (eg. referers.txt) is limited by your servers PHP settings. I would start with a file of up to 200kb and increase the size by 200kb increments till the script stops working.
b) some SE's send info as UTF8, others as EUC-JP so if you change the page encoding option, you should get a different visible result. Otherwise, you can try saving the output as an html file, and view it in your browser and then change the encoding in your browser.

Give this one a go...

------ COPY ALL BELOW THIS LINE AND SAVE AS decode.php -------
<?
$fd = fopen ($file, "r");
if($fd)
{
$text = fread ($fd, filesize ($file));
fclose ($fd);
}
else
{
$text = 'invalid filename';
}
$text = urldecode($text);
$text = nl2br($text);
?>
<html lang=ja>
<head>
<title>URLDECODE</title>
</head>
<body>
<? echo $text;?>
<center>
<form action="<?php echo $PHP_SELF;?>" method="post">
<input type="text" name="file" size="30"><br>
<input type="submit" value="Convert Text" name="convert">
</form>
<br>
</center>
</body>
</html>
------ COPY ALL ABOVE THIS LINE AND SAVE AS decode.php -------

btw, I didn't test this but do let me know if you have any issues and I'll try to help.

G'luck,
Kaz

Josefu

9:27 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



Hay, thanks a lot! I hope I have time to test it this weekend, I'll let you know how it goes. Thanks for taking the time out for me : )