I have a dictionary:

```
mydict={'öö':1,'ää':2}

```

I have written it to a pickle file:

```
a=codecs.open(r'mydict.pkl', 'wb', 'utf-8')
pickle.dump(mydict, a)

```

If I try to load it:

```
m=codecs.open(r'mydict.pkl', 'rb', 'utf-8')
mydict = pickle.load(m)

```

I get an error:

```
KeyError: u"S'\\xe4\\xe4'\np1\nI2\nsS'\\xf6\\xf6'\np2\nI1\ns."

```

Any ideas how to solve this? Help is greatly appriciated.