Closed Able1991 closed 11 years ago
socrs = DBF::Table.new path , nil, 'cp866' resolve it =)
Unfortunately, it is very common for the encoding to not be set correctly in the file. I'm glad you figured it out. I will update the README file about this issue.
welcome here is my code
socrs = DBF::Table.new(Rails.root.join('fias','socrbase.dbf')) socr = socrs.find(1) puts socr.scname
at the command line I see - "????????? ??????"
files are taken from the database of the Federal Information Address System of the Russian Federation - http://fias.nalog.ru/Public/DownloadPage.aspx file is not damaged, successfully read DBFViewer may bug is related to the presence of Russian characters?
socr.to_json return - {"data":["1 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 0 "],"columns":[{"enc oding":null,"version":"03","decimal":0,"length":5,"type":"C","name":"LEVEL","underscored_name":"level"},{"encoding":null,"version":"03","decimal":0,"length":50,"type":"C","name":"SOCRN AME","underscored_name":"socrname"},{"encoding":null,"version":"03","decimal":0,"length":10,"type":"C","name":"SCNAME","underscored_name":"scname"},{"encoding":null,"version":"03","dec imal":0,"length":4,"type":"C","name":"KOD_T_ST","underscored_name":"kod_t_st"}],"version":"03","memo":null,"column_names":["level","socrname","scname","kod_t_st"]}