proper db encoding