pcall (dofile,m_simpleTV.MainScriptDir .. "lib/channel_filter.lua")
pcall (dofile,m_simpleTV.MainScriptDir .. "lib/epg_filter.lua")
if 	    DefaultMassNames~=nil 
	or  epgFilterTableFirst~=nil 
	or epgFilterTable ~=nil then

	local mess
	if m_simpleTV.Interface.GetLanguage()== 'ru' then
	mess = [[Найдены устаревшие channel_filter.lua или epg_filter.lua.
Измените имена на channel_filterUtf8.lua, epg_filterUtf8.lua и сохраните как 'UTF-8 without BOM'.
Сделать это сейчас ?]]	
	else
	mess = [[Found old channel_filter.lua or epg_filter.lua.
Change names to channel_filterUtf8.lua, epg_filterUtf8.lua and save as 'UTF-8 without BOM'
Do it now ?]]	
	end
			
    if m_simpleTV.Interface.MessageBox(mess,"simpleTV",0x24) == 6 then
	
	local  function moveFile(oldName,newName)
	  local fullOldName = m_simpleTV.MainScriptDir .. 'lib/' .. oldName
	  local fullOldNameBak = m_simpleTV.MainScriptDir .. 'lib/' .. string.gsub(oldName,'lua$','bak')
	  local fullNewName = m_simpleTV.MainScriptDir .. 'lib/' .. newName
	  local fullNewNameBak = m_simpleTV.MainScriptDir .. 'lib/' .. string.gsub(newName,'lua$','bak')
	  
	  local fhandle = io.open(fullOldName,'r')
	  if fhandle == nil then return true end

	  fhandle:seek("set", 0) 
	  local data = fhandle:read("*a")
	  fhandle:close()							 
	  
	  data = m_simpleTV.Common.multiByteToUTF8(data)
	  
	  os.rename (fullNewName, fullNewNameBak)
	  local fhandle,errStr = io.open(fullNewName,'w+')
	  if fhandle == nil then 
	   return false,errStr
	  end
	  	  
	  fhandle:seek("set", 0) 
	  fhandle:write(data)
	  fhandle:close()							 
	        	  
	  local err,errStr = os.rename (fullOldName, fullOldNameBak)
	  if err == nil then 
	   return false,errStr
	  end

      return true	  	  
	end
	
	local err,errStr = moveFile('channel_filter.lua', 'channel_filterUtf8.lua')
	if err~=true then
	 m_simpleTV.Interface.MessageBox( m_simpleTV.Common.multiByteToUTF8(errStr or 'unknown error') ,"simpleTV",0x10)
	 return
	end
	
	err,errStr = moveFile('epg_filter.lua', 'epg_filterUtf8.lua')
	if err~=true then
	 m_simpleTV.Interface.MessageBox( m_simpleTV.Common.multiByteToUTF8(errStr or 'unknown error') ,"simpleTV",0x10)
	 return
	end
	
   end	
	DefaultMassNames   = nil 
	epgFilterTableFirst= nil 
	epgFilterTable     = nil	
end
