Author |
Message |
prekill
Worker


Joined: Oct 22, 2005
Posts: 201
|
Posted:
Tue Jun 14, 2011 4:21 am |
|
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.) |
|
|
|
 |
prekill

|
Posted:
Wed Jun 15, 2011 9:12 am |
|
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
|
Posted:
Thu Jun 16, 2011 1:58 pm |
|
Seems you cross posted, which is confusing. Are you using this site or nukeSEO for your enquiry, just so people know where to reply. |
|
|
|
 |
prekill

|
Posted:
Thu Jun 16, 2011 3:33 pm |
|
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

|
Posted:
Thu Jun 16, 2011 4:14 pm |
|
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.
http://php.net/manual/en/function.mb-convert-encoding.php |
|
|
|
 |
prekill

|
Posted:
Sun Jun 19, 2011 3:11 am |
|
I am have some difficulties to convert this:
$str = preg_replace('/(\[(\S+)\]|&(?![a-zA-Z]{2,6} )/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
|
Posted:
Sun Jun 19, 2011 11:37 am |
|
prekill wrote: | I am have some difficulties to convert this:
$str = preg_replace('/(\[(\S+)\]|&(?![a-zA-Z]{2,6} )/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. |
|
|
 |
prekill

|
Posted:
Sun Jun 19, 2011 3:34 pm |
|
but its not working...
i still see in the description [web:65450]http://khkjhk[/web] and such...
Please advise
thanks
 |
|
|
|
 |
spasticdonkey
RavenNuke(tm) Development Team

Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Sun Jun 19, 2011 7:06 pm |
|
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. |
|
|
|
 |
prekill

|
Posted:
Mon Jun 20, 2011 12:52 am |
|
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. http://XXXX)
Thanks! |
|
|
|
 |
prekill

|
Posted:
Mon Jun 20, 2011 7:45 am |
|
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

|
Posted:
Mon Jun 20, 2011 9:32 am |
|
Can you post a link to one of your pages where you have these links in the meta?
I'm just curious. |
|
|
|
 |
prekill

|
Posted:
Tue Jun 21, 2011 10:52 am |
|
sorry Guardian2003, its all in a dev environment (localhost on my pc).. |
|
|
|
 |
|