vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   query to find, then update characters in post titles & body (https://vborg.vbsupport.ru/showthread.php?t=211296)

gabeanderson 04-15-2009 07:16 PM

query to find, then update characters in post titles & body
 
1 Attachment(s)
I changed the encoding of my forums from ISO-8859-1 to UTF-8. As a result, I'm finding a number of undesired characters in posts, such as "�" in place of a single quote (likely because it was initially input / copied as a right single quote).

Also, the HTML code for right single quote is displaying verbatim in some places rather than as a quote.

The attached screenshot shows an example of both instances (source post).

I'd like to run a query first to find all instances where these two issues occur (in post titles and post text). Then update all.

I've done some test queries, but am not having luck getting any results back.

Suggestions on the queries?

Thanks.

vbplusme 04-16-2009 06:07 AM

Are you using phpMyAdmin to run your queries?

gabeanderson 04-16-2009 12:20 PM

I'm using the "Execute SQL Query" feature via Admin CP.

gabeanderson 04-20-2009 01:11 PM

Anyone? Anyone?

I'm just looking for something like this, but want to confirm the syntax:

Code:

select * from posts
where title like 'funky-character';

And this:

Code:

select * from posts
where body-text like 'funky-character';

Thanks!

gabeanderson 04-22-2009 02:09 PM

It doesn't seem like this should be too difficult... I'm sure I'm just missing something obvious.

Any pointers, please?

Thanks!

Lynne 04-22-2009 03:11 PM

You might want to use % in the like area (% is a wilcard). Also, the table is called "post" and the body-text is stored in a field called "pagetext". So, something more like:
PHP Code:

select from post
where pagetext like 
'%funky-character%' 

That will find the posts with the funky_character in them. (I think - I am no mysql guru!) Also, if you have a table prefix, you will have to put that in front of "post".

gabeanderson 04-22-2009 06:32 PM

1 Attachment(s)
Thanks, Lynne! That did it for basic searches. But I still can't seem to get my funky characters (like �) to show up in query results by pasting it in.

That's how some characters show up in query results, but I guess they're encoded in the database some other way...

Example query results for this post is attached.

I know that character was originally "»" (and have since removed that from the page title of links like it), but trying a query like the below yields no results:

Code:

select * from post
where pagetext like '%raquo%'

Any other ideas?

Thanks!

Lynne 04-22-2009 06:42 PM

If you know it's in that exact post, have you tried looking at the pagetext for that postid and seeing exactly what is written in there?

Also, are you using page caching? If so, you'll want to turn that off (set cached posts lifespan to 0) for now.

gabeanderson 04-22-2009 06:54 PM

Hi Lynne- The above screenshot does show exactly what's in the pagetext for the post - for this example... but the point is that this character may exist in potentially hundreds of other posts since I changed the encoding to UTF-8, not just in this one.

So the problem is how I identify those posts since running the query to find the "�" character is not working.

Lynne 04-22-2009 07:11 PM

So does "�" show up in posttext or does "»" show up in the posttext (I'm talking about exactly what is in the field in the database)? Like if you did a select posttext from post where postid=50736, what do you get in there?


All times are GMT. The time now is 09:19 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01671 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete