UTF-8 fixing script
Here's a little experimental script to correct encoding mishaps in MYSQL dumps. Use with care, YMMV.
//script to fix busted utf-8 encoding
$username = 'YOURUSERNAME';
$password = 'YOURPASSWORD';
$mysql = mysql_connect( 'localhost', $username, $password );
echo 'Cannot connect to database.';
// put in your database name here:
$db = 'apr_drupal_2';
$tablequery = "SHOW TABLES FROM ".$db;
$tablequery_result = mysql_query($tablequery);
while($tablerow = mysql_fetch_array($tablequery_result))
$table = $tablerow;
$fieldsquery = "select * from ".$db.".".$table."";
$fields_result = mysql_query($fieldsquery);
$num_fields = mysql_num_fields($fields_result);
for ($j = 0; $j < $num_fields ; $j++)
$column = mysql_field_name($fields_result, $j);
$query = "select ".$column." from ".$db.".".$table."";
$result = mysql_query($query);
$num_result = mysql_num_rows($result);
for ($i = 0; $i < $num_result; $i++)
$thing1 = mysql_result($result,$i);
$thing2 = utf8_decode($thing1);
$queryreplace = "update ".$db.".".$table." set ".$column." = '".$thing2."' where ".$column." = '".$thing1."'";
Submitted by canary on Tue, 03/02/2010 - 4:46pm
Tags in Tags
- Philly arts and culture reporters share tips on how to get great press coverage
- Blog post: Outside(r) Art
- Philly arts organizations take on social media fads: A short history
- Entrepreneurship and Risk-Taking in Arts Organizations
- A Look Ahead This Month
- Philly's Top Broadcasters Weigh In: What Makes the Evening News?
- Top 10 Philadelphia Arts and Culture Orgs on Pinterest
- Be a Belieber in marketing your arts organization to teenagers
- Top Arts Marketing Resources for 2014
- The Constant Grammarian: Three Grammar Resolutions You'll Want to Keep in 2014
- 2014: The Year Ahead
- ICYMI: Getting meta on social media, and other November reading
- Making Spirits Bright: Canary’s Holiday Favorites
- Canary Promotion Wins Two Awards from the PRSA!
- ICYMI: What would you do if you were banned from Twitter?
- Messaging in a Bottle: How to Tell a Compelling “Story of Us”
- The Hot Topic of Crowdfunding for Conservation
- ICYMI: Where we've been this fall, and where we're going
- Canary Guest Blogs for Americans for the Arts: A Holistic Approach to Communications
- PR in the Age of Shortening: Should we join ’em if we can’t beat ’em?
- Megan Wendell on Keystone Edge: Growth, inspiration and putting the arts first
- Canary in Harrisburg for the Launch of Pennsylvania’s Top 10 Endangered Artifacts
- Canary News: Fall Arts Bounty, Winning at the Geek Awards, Social Media Tips
- Playing Favorites: Where to find the Canary staff at the 2013 Fringe Festival
- Weekend Wrap Up: Great Press for Mauckingbird and Puppet Festival (r)Evolution
- More Than Words: Bringing Audiences Into the Moment with Instagram
- ICYMI: What We're Reading This Summer
- 6 Ways Twitter Can Help Sell Tickets (Part 2)
- 6 Ways Twitter Can Help Sell Tickets (Part 1)
- Adventures in Pittsburgh: How cultural storytelling can invigorate a city
- ICYMI: What Caught Our Attention in May
- The Constant Grammarian, Part 3: Thou Art Banished
- Spring 2013 Newsletter: What Kind of Leader Are You?
- Crowdsourcing: How Honesty Moves Us Forward
- So You’ve Hired a Communications Team – Now What?
- ICYMI: What Caught Our Attention in April
- Third Time’s the Charm: Congratulations to the 43 winners of the 2013 Knight Arts Challenge!
- Five Signs It’s Time to Hire a Communications Firm
- Stop Wasting Money: How to Stretch Your Facebook Ad Dollars
- ICYMI: What Caught Our Attention in March
- Take readers behind the scenes — even while you're setting the stage: A content marketing strategy for arts organizations
- Faces of PRSA Philly: The Canary edition
- Connecting Organically: How PR drives SEO results
- The Future of Cultural Journalism: Inspiration, Innovation and Proactivity
- What’s the future of cultural journalism? How can art connect communities?
- Canary Goes Global: World-class culture in the City of Brotherly Love
- Cultural Moments of 2012: Megan's Picks
- Cultural Moments of 2012: Rose's Picks
- Cultural Moments of 2012: Carolyn's Picks
- A Better Barrymore? Theatre Philadelphia: A Celebration! gave the arts community a much-needed boost at just the right moment.
- Internship Alert: Canary Promotion is hiring PR/Marketing interns this fall!
- Philly 101 Wrap Party @ Frankford Hall: What You Wish You Knew, Now You Know
- The Constant Grammarian, Part 1: Seven Words and Phrases You Didn’t Know You Didn’t Know
- Canary Promotion Newsletter: Summer 2012
- Insight into Insights: Reach Your Goals With the Right Facebook Campaign
- Insight into Insights: Reach Your Goals With the Right Facebook Campaign
- Congratulations to the 2012 Knight Arts Challenge Philadelphia winners!
- Rediscover Public Art with Fairmount Park Art Association
- 5 Things You Can Do For Your Small Business Right Now
- Canary Promotion Welcomes Carolyn Huckabay of Philadelphia City Paper as Public Relations Associate
- 10 years, a bounty of art, and a job that still thrills me
- Young Voices Were On the Minds of TEDxPhilly Speakers
- Festivals, Public Art, Drama & Dracula: What We're Working On This Season
- Plenty to see this weekend as DesignPhiladelphia winds down. Stop by Not A Vacant Lot!
- 6 Tips for Getting Press-Perfect Photos
- Knight Foundation and NEA Seek New Models for Arts Journalism
- Live Arts Festival Tickets On Sale Now!
- With Facebook Ads, It's All About the Timing.
- We're hiring: PR & Marketing Coordinator position available
- The Value of Intangible Goods. How Donating Your Knowledge Makes a Difference.
- The Cultural Engagement Index, Why Audience Participation Matters
- Congratulations to all of the Knight Arts Challenge Philadelphia 2011 Winners!
- A mural party at the Rosenbach, a frank conversation with Maurice Sendak & the musically inspired “Grace Notes”
- Canary Promotion Newsletter: Spring 2011
- Spring is in the air! The Canary office gets spruced up for Spring.
- Our PIFA Picks: A Cultural Playground in April
- 6 Essentials for Successfully Working with the Media
- Woodmere Art Museum Opens Five New Exhibitions
- Spring Break at Live Arts Brewery - A Laboratory for Research and Development
- Connecting With Your Community Through Facebook Ads
- Ars Nova Workshop presents Fieldwork, “A jazz power trio for the new century” (NPR)
- Put A Bird On It!
- Final Days to See John Folinsbee and American Modernism at the Woodmere
- 7 Ways to Improve Your PR Writing
- Sometimes these Canaries need their creative-beauty sleep
- Young Voices High School Monologue Festival On Stage at The Adrienne Theater This Week
- The Associated Press, NPR, Philadelphia Inquirer & New York Times are all talking about the Rosenbach's Sendak Mural
- John Folinsbee and American Modernism Lecture Series at Woodmere Art Museum
- Our Favorite Cultural Moments of 2010: Megans' Picks
- Our Favorite Cultural Moments of 2010: TEDxPhilly
- Our favorite cultural moments of 2010: Flash Opera, The Return of the Cultural Flash Mob to Philadelphia
- Our 2010 Year in Review
- We're taking a holiday break!
- Rescue Your Blog with an Editorial Calendar
- Philadelphia’s got talent, United States Artists Knight Fellows announced
- Holiday Shop at Woodmere Art Museum
- Ladies Rock Camp - the perfect gift for the ladies in your life
- Museum Without Walls: AUDIO the subject of national Associated Press story
- Chester County Historical Society Launches Social Media Campaign
- The Rosenbach Museum & Library announced today news of stunning new portraiture acquisitions
- Woodmere Art Museum Upcoming Community Events
- Theater showcase by & for youth in Philadelphia touches on big issues at the right time
- TEDxPhilly, November 18, 2010 at the Kimmel Center.
- Canary clients have "Big Vision" says City Paper - We Agree!
- Spooky. Canary's tips for Halloween-themed events in Philly
- Coming Up: opportunities to get your Knight Arts Challenge questions answered
- Mayor Nutter, Arts Community Celebrate Knight Arts Challenge Philadelphia Launch
- Coming Oct. 5: Knight Foundation brings new support to the arts in Philadelphia
- Have you heard? The Philadelphia Live Arts Festival and Philly Fringe is taking over!
- Two thumbs up for Mauckingbird's revamped queer "A Midsummer Night's Dream"
- How creative PR & marketing work together to draw in new audiences
- Museum Without Walls™: AUDIO wins Philadelphia Magazine BEST of PHILLY 2010 Award!
- The Rosenbach's new 'Dreadful Things Happen' exhibition reviewed in today's Inquirer
- Philadelphia Weekly “Picks for Best Theater This Year” Includes Five Canary Client Mentions!
- Canary News: Announcing some changes & new opportunities
- We're Looking for PR/Marketing Interns for the Fall!
- Fringe Fest Sideshow: Opportunity for Philly Fringe Artists & Fans
- Today, Celebrate Bloomsday with the Rosenbach Museum & Library at Trinity Center for Urban Life
- Museum Without Walls™: AUDIO Program Officially Launches at LOVE Park
- Thursday, June 10th, Fairmount Park Art Association launches the groundbreaking Museum Without Walls™: AUDIO program in LOVE Park!
- The Wilma Theater's U.S. Premiere of "Leaving" Opens TONIGHT!
- Drupaldelphia Wrap-Up
- Canary client Swim Pony Performing Arts will host Philadelphia's next large-scale improv event!
- The 2010 Philadelphia Live Arts Festival + Philly Fringe Line-up is Announced!
- Google Chrome - Search Any Site from the Address Bar
- The New York Times reviews Philagrafika 2010, a Canary PR client!
- displaying location fields in a view
- Happy 200th Birthday, Edgar!: Brat Productions Celebrates with One-of-a-kind Theatrical Haunted House
- safari clips div when using anchor tags
- Philadelphia: Where the Wild Things Are + Sendak Mania at the Rosenbach
- string parsing code to get url from image tag
- Philadelphia Live Arts Festival & Philly Fringe Opens Today!
- Pig Iron Theatre Company's Welcome to Yuba City
- We're hiring! FT Publicity & Marketing Assistant
- Replace Taxonomy pages w/ Embed Views
- Embed Views
- creating a style for every n-th item in a list
- incremental classes when grouping multiple cck values in views
- Custom CCK Formats
- Blueprint Grid Overlay in the Browser
- Grid Nirvana - How to Easily Incorporate Blueprint into Photoshop
- running cron.php from crontab
- redirect traffic from a subdomain to the root
- Theming a page by arbitrary content types
- Bloomsday Gives Joyceans a Reason to Love Philadelphia
- Get the path to a Drupal module or theme
- IE doesn't load stylesheets / IE doesn't load conditional comment stylesheets
- IE6 PNG Fix
- Watch nEW Festival Artist Interviews on StreetTalkin.com
- Add a custom ID to menu items based on the text in the link
- Even out different date fields across content types
- Embed Views2 blocks w/ PHP
- EmField Error: "Sorry, you need to install flash to see this content."
- Views2: Find the first NID from another view to use as an argument
- Watch WHYY: Experience Philadelphia Young Playwrights
- delete .svn folders from the cli
- Convert string to CSS friendly text
- Display taxonomy terms from one vocabulary id
- Web Design and Drupal Internship Available
- DrupalCon DC as a mind map
- Canary at DrupalCon DC
- Canary Promotion + Design seeks Web Designer/Developer
- PR/Marketing Internship Opening
- custom jQuery accordion menu function for drupal primary menu
- South Street offers empty storefronts to artists
- Client Testimonial: Neil Baldwin
- DrupalCamp Philly
- memory error: Fatal error: Allowed memory size of ...
- Complaint Choir on CBS 3!
- The 6 Dangerous Fallacies of Social Media
- Inaugural BarCamp Philly to be held November 8
- Treehouse of Horror: Canary Pumpkins Rule the Night
- First Person Festival
- calibrate your monitor
- Val Emmich, Little Daggers
- Ben Franklin persists
- Rock 'n' Roll at The Wilma Theater
- Sarah Palin and Hillary Clinton on SNL
- Help Elect Barack Obama. We can't afford to lose this.
- Connecting to MYSQL via terminal
- Live Arts Festival & Philly Fringe: in print, online & on the air
- Live Arts Festival’s Kate Watson-Wallace talks Car in PW cover story
- Take the A List Apart Survey for People Who Make Websites
- White Screen of Death [WSOD] on form Submit
- find and delete files in ssh
- Mauckingbird's R&J in the Inquirer
- Girls Rock Camp on MTV
- Classic Towns of Greater Philadelphia
- Philly's New Culture Chief
- First Person Impressions
- Mayor Nutter announces Arts & Culture Office
- split arrays into two for multiple columns
- Placing the contents of a block in any location
- Free your content of PHP: Moving PHP code out of blocks, views and nodes
- How to Call Attention to Yourself
- Ben Franklin & Betsy Ross Wedding
- Delete nodes programatically through Drupal
- Backup/Restore MySQL via SSH if you can't access phpmyadmin
- Drupal user guides
- Clean URLs on IIS
- Why good design matters
- Bloomsday at the Rosenbach today!
- ffmpeg, the flashvideo module and testing locally on Windows
- Browser detection in PHP
- Drupal Meetup at Canary Recap
- Sendak on Sendak on Video
- adding the servername to site5 nameservers
- clean urls on site5 before the domain is active
- Creating email addresses on Site5
- Vote Early, Vote Obama
- Views Theming Wizard output incorrect
- remotely connect to mysql server - Site5
- File permissions
- wait for full page to load (not just the DOM) when resizing elements with jquery
- Emulate word-wrap in Mozilla Firefox
- 500 Internal Server Error upon uploading site to Site5
- Lost Weekend: SXSWi 2008
- MYSQL ERROR: "MySQL server has gone away"
- Day One at SXSW
- SXSW Marathon, or, Will We Really Get to All 30 Panels?
- My loony bun is fine, Benny Lava.
- Dispatches from Google chat: Jon Stewart strikebuster edition.
- The Museum of Baby Heads
- WING TIPS: Canary's Favorite Things - Cool Gifts for the Holidays
- Best Potential Client Inquiry Ever
- White Board: Stinky
- Just a few vacation photos
- machines machines machines... featured on FOX Philadelphia!
- How to talk to the media
- Cold Rock The Auction Block
- Where the Wild Things Are
- Take the Chekhov Lizardbrain Challenge
- I leave for SXSW this week
- Anton Chekhov is Taking Over Philadelphia
- Snow Days
- The Hoohah Monologues
- It's the Arts, stupid
- Little Fat Man Who Sold His Soul
- Wing Tip - Tour the UK
- Image Makeover with Paul Mecurio
- Happy Birthday, Megan!
- PhillyHistory.org on Phawker.com
- Doin' the Wife Swap Rock
- Canary on Breakthruradio
- New Play Festival site online
- Michael Cera - Impossible is the Opposite of Possible
- Canaryist, Part Two
- A John Dorian Christmas, or, You're a Good Man, JD
- December Wing Tips
- Donate to a music community friend
- Media Darling
- Will It Blend?
- I've obviously had hundreds of girlfriends.
- His Dark Materials musings in this week's Philadelphia City Paper
- Paris by night
- Canary Nabs Philadelphia City Paper Choice Award
- Live Arts/Philly Fringe recap, Sept. 9-16
- Live Arts/Philly Fringe recap, Sept. 5-8
- Amnesia Curiosa
- Proper Manners and Haunting Houses
- Still Unknown
- Dark times in trucks and the old west
- Cheerleaders, strippers and puppets, oh my!