Thread:Project:Support desk/Padded spaces in page titles and user names after a DB copy

I copied a database using an SQL dump generated by phpmyadmin. This mostly seems to have worked, but I had a weird problem with page title and user names. They seemed to pick up a whole load of padding space characters. These were visible as a long line of underscores generated in links in various places. It looked like various title database fields, I presume because of the dump format, had been padded out with space characters. It looks like I've fixed this now. I ran maintenance/update.php (I was also going from 1.15 to 1.16 version) and that seemed to deal with article page titles. But then I also seemed to have a problem with user names. I ended up fixing this with...

UPDATE user SET user_name=TRIM(user_name);

Things are mostly working now, but links to user pages are still showing up red for some reason, and I have the feeling I may discover other things which are wrong with my install now. Anyone seen this space padding problem? Is there a magic sort-everything-out maintenance script for this case? or even just for refreshing the state of red links?