I have a dictionary data where I have stored:
key - ID of an event
value - the name of this event, w
The exception is caused by the contents of your data dictionary, at least one of the keys or values is not UTF-8 encoded.
You'll have to replace this value; either by substituting a value that is UTF-8 encoded, or by decoding it to a unicode object by decoding just that value with whatever encoding is the correct encoding for that value:
data['142'] = data['142'].decode('latin-1')
to decode that string as a Latin-1-encoded value instead.