How to fix non-utf8 names when loading old blend files?
It's possible to get strings in Python as bytes, which allows to re-encode them into utf-8:

Eg:

import bpy
for m in bpy.data.materials:
    name_as_bytes = m.path_resolve("name", False).as_bytes()
    name_as_utf8 = name_as_bytes.decode('utf8', 'surrogateescape')
    m.name = name_as_utf8


To run this on your entire file:

import bpy

def id_iter():
    type_iter = type(bpy.data.objects)

    for attr in dir(bpy.data):
        data_iter = getattr(bpy.data, attr, None)
        if type(data_iter) == type_iter:
            for id_data in data_iter:
                if id_data.library is None:
                    yield id_data

def wash_name(id_data)
    name_as_bytes = id_data.path_resolve("name", False).as_bytes()
    name_as_utf8 = name_as_bytes.decode('utf8', 'surrogateescape')
    id_data.name = name_as_utf8

for id_data in id_iter():
    wash_name(id_data)




Ideally loading old files will always work. In this case it's not done because its a big change for a relatively rare problem.