Jump to content
Alloder.pro  about Allods with love 😱
Search In
  • More options...
Find results that contain...
Find results in...

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

Digest April

We talk about what was done and updated in the past month. We help keep abreast of events.

Read more

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

Read more

Проблема с кодировками при сохранении.


Loss
 Share

Recommended Posts

При разработки своего аддона по сборке игровой информации нашелся человек у которого были проблемы с кодировкой в файле потому, что в игре есть баг при сохранении на иностранных ОС. Вот я нашел решение данной проблемы. Каждый символ хранится в коде. В связи с тем что Аллоды работают только под WIn то код символов всегда одинаков.

Code:
function code(param)

if param then

local a = ""

for i = 1, string.len(param) do

if i == string.len(param) then

local e = string.byte(param, i)

if e < 100 then e = "0" .. e end

a = a .. e

else

local e = string.byte(param, i)

if e < 100 then e = "0" .. e end

a = a .. e ..","

end

end

return a

end

end

function encode(param)

if param then

local d = ""

for i = 1, string.len(param) do

local c = string.sub(param, i, i+2)

d = d .. string.char©

i = i + 3

end

return d

end

end

Функция code() кодирует русские строки, а функция encode() переводит эх обратно. Проверенно на моем аддоне.

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use