Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> nukeSEO
Author Message
prekill
Worker
Worker



Joined: Oct 22, 2005
Posts: 201

PostPosted: Tue Jun 14, 2011 4:21 am Reply with quote

Hey Guys,

I am trying to use NukeSEO DH but seeing all kind of "?" in title, keywords and description meta. I am working with UTF-8..

I looked at the code and change few functions to mb_xxx (multi byte - utf8) but still see "?" any advise on how to get this thing working with UTF-8?


Thanks!

(Using UTF-8 Because of herbew.)
 
View user's profile Send private message
prekill







PostPosted: Wed Jun 15, 2011 9:12 am Reply with quote

I am now sure all the problems i'm haveing is have something to do with this function:

Code:
// Strip html and truncate to create a META value.

function seoHTMLtoMETA($str, $type = 'KEYWORDS', $length = 70) {
   require_once 'includes/seo_fns.php';
   $str = preg_replace('/(\[(\S+)\]|&(?![a-zA-Z]{2,6};))/sU', '', $str); // Remove BBCode and chopped off entities
   $str = check_html($str, 'nohtml'); // Remove HTML tags
   $str = preg_replace('/(\s+)/', ' ', $str); // Remove all internal whitepace, replace with single space
   $entities = array('(tm)','"', '©', '>', '<',
      ' ', '™', '®', ';',
      chr(10), chr(13), chr(9));
   $str = html_entity_decode(seo_simple_strip_tags($str));
   if ($type == 'DESCRIPTION') $str = str_replace($entities, '', $str);
   $str = htmlspecialchars($str);
   // Remove stop words from keyword content, then convert to most popular keywords
   if ($type == 'KEYWORDS' and $str > '') $str = seoGetAutoKeys($str);
   $metavalue = truncate_string($str, $length);
   if (mb_strlen($str) > mb_strlen($metavalue)) $metavalue .= "...";
   return $metavalue;
}
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Thu Jun 16, 2011 1:58 pm Reply with quote

Seems you cross posted, which is confusing. Are you using this site or nukeSEO for your enquiry, just so people know where to reply.
 
View user's profile Send private message Send e-mail
prekill







PostPosted: Thu Jun 16, 2011 3:33 pm Reply with quote

Hey Guardian2003, Sorry for that.


Quote:

Is your main DOCTYPE issuing a utf-8 charset?
What about the forums as they send their own?
Is the data stored in the database actually utf-8 or is the browser mis-interpreting them once displayed on the page?

Sorry for what might seem like stupid questions but I thinks it's important to ascertain whether the original data is utf-8 or not before you do anything else.


yes, doctype is utf-8 also server send headers as utf-8, and mysql is utf-8 as well.

I have add to db/mysql.php utf-8 encoding too and set names for utf-8.

I think it has something to do with the functions SEO DH is using which are not multi byte compatible. I have started to chage the dh.class.php to mb_xxxx functions and it seems im getting on the right track.

Currently im coverting preg_replace to mb_ereg_replace.

What do you think?

Thanks.
 
Guardian2003







PostPosted: Thu Jun 16, 2011 4:14 pm Reply with quote

That is one of the reasons I asked if you had checked the data in the database itself. If you had data in there before converting to utf-8, that could be causing the problem (especially with the language you are using).
If you have a mix of data stored using different character encodings, you could probably use mb_convert_encoding() to make sure the string is consistent. [ Only registered users can see links on this board! Get registered or login! ]
 
prekill







PostPosted: Sun Jun 19, 2011 3:11 am Reply with quote

I am have some difficulties to convert this:

$str = preg_replace('/(\[(\S+)\]|&(?![a-zA-Z]{2,6}Wink)/sU', '', $str); // Remove BBCode and chopped off entities

to mb_ereg_replace, someone can give me a hand?

Thanks!
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Jun 19, 2011 11:37 am Reply with quote

prekill wrote:
I am have some difficulties to convert this:

$str = preg_replace('/(\[(\S+)\]|&(?![a-zA-Z]{2,6}Wink)/sU', '', $str); // Remove BBCode and chopped off entities

to mb_ereg_replace, someone can give me a hand?

Thanks!


You should not have to convert this. preg_replace has multi-byte support. It is enabled with the "u" modifier that is used in the code in question.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
prekill







PostPosted: Sun Jun 19, 2011 3:34 pm Reply with quote

but its not working...

i still see in the description [web:65450]http://khkjhk[/web] and such...

Please advise

thanks

Smile
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Sun Jun 19, 2011 7:06 pm Reply with quote

I would guess you have added some bbcode mods and the preg_replace isn't matching for [web:65450]

If this is the feature that allows embedding a webpage in an iframe I would recommend you not use that. Too easy these days for someone to load a malicious page and potentially infect other users/visitors, imo.
 
View user's profile Send private message Visit poster's website
prekill







PostPosted: Mon Jun 20, 2011 12:52 am Reply with quote

Umm I see,

I will take into account. BUT! LOL

Even if I will remove the Mode, those queries are still in the DB.

How will I be able to remove those and not show it the meta?

+

I will want to remove any link appear in the meta. (ex. [ Only registered users can see links on this board! Get registered or login! ]

Thanks!
 
prekill







PostPosted: Mon Jun 20, 2011 7:45 am Reply with quote

I have added those too:

Code:
$str = mb_ereg_replace('(http://\S+)', ' ', $str); // Remove all links in meta

$str = mb_ereg_replace('(www.\S+)', ' ', $str); // Remove all links in meta


What do you think?

p.s I want to add some default keywords to be used every time no meter what, how can I add those?

Can it cause any problem?
 
Guardian2003







PostPosted: Mon Jun 20, 2011 9:32 am Reply with quote

Can you post a link to one of your pages where you have these links in the meta?
I'm just curious.
 
prekill







PostPosted: Tue Jun 21, 2011 10:52 am Reply with quote

sorry Guardian2003, its all in a dev environment (localhost on my pc)..
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> nukeSEO

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©