User login

MetaTraffic 2.0 Boxshot

Solution : Search Engine Turkish Character Replace.

Posted by Webdeveloper [February 3, 2009]

Hi;

I have found a solution about search engine Turkish characters string like (ömer, ılgın, süreyya ı-ö-ü)

Problem :
------------------------------------------
MetaTraffic2 using default charset UTF-8 for database record inserting but when you look search engine keyword statistics (Search Engines > Keywords) you can see unknown UTF-8 encoding turkish letters. and There is sometimes cannot understand, because dont mean in Turkish.

Solution :
------------------------------------------
Step 1 : Open your core.asp file in your metatraffic2 folder (or your renamed folder with contains metatraffic2 files) and add to bottom of function

Function ReplaceTRCharsDef(strIncChars)
strIncChars = Replace(strIncChars,"ı","ı")
strIncChars = Replace(strIncChars,"ö","ö")
strIncChars = Replace(strIncChars,"Ö","Ö")
strIncChars = Replace(strIncChars,"ÄŸ","ğ")
strIncChars = Replace(strIncChars,"İ","İ")
strIncChars = Replace(strIncChars,"ç","ç")
strIncChars = Replace(strIncChars,"Ç","Ç")
strIncChars = Replace(strIncChars,"ÅŸ","ş")
strIncChars = Replace(strIncChars,"ü","ü")
strIncChars = Replace(strIncChars,"Ü","Ü")
strIncChars = Replace(strIncChars,"Å","Ş")
strIncChars = Replace(strIncChars,"Ä","Ğ")
ReplaceTRCharsDef = strIncChars
End Function

Function Description : This function replace all known UTF-8 formatted Turkish characters with original characters.

Step 2 : You can work again with core.asp in your metatraffic2 folder (or your renamed folder with contains metatraffic2 files) and add to bottom of function.

Function ReplaceTRCharsFromDB()

Set rsRecordFields=server.CreateObject("ADODB.RecordSet")
rsRecordFields.Open "SELECT k_value FROM mt_Keywords",objConn,1,3
if rsRecordFields.eof then
else
Do While Not rsRecordFields.Eof
rsRecordFields("k_value") = ReplaceTRCharsDef(rsRecordFields("k_value"))
rsRecordFields.update
rsRecordFields.Movenext:Loop:end if:rsRecordFields.close:set rsRecordFields = nothing

End Function

Function Description : This function Call with your string (including UTF-8 formated characters and returns correct keywords from function.

Step 3 : Open your track.asp file, goto line 91 and add "Call ReplaceTRCharsFromDB()" (you can see example from bottom)

Set objTrack = Nothing
Call ReplaceTRCharsFromDB()
Call CloseDatabaseConnection()

Code Description : This code replace UTF-8 non-correct formatted Turkish character from your ?_Keywords table every visit of web page. When you growing up your keywords in your keywords table, you must optimize your ?_Keywords table. Because you can see performance problems in your site.

Thank You.
and Hello from Turkiye!
Cihan YILMAZ
www.cihanyilmaz.com