Forum: wxRuby STC encoding

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
86d42d3251111ae7de3fab04e8eddc76?d=identicon&s=25 Maciej S. (mszatanik)
on 2010-05-28 12:58
i'd like to use StyledTextCtrl in my aplication, to edit Watir tests.

But i have a great problem with encoding, i work on windows xp
(unfortunately) and all tests i have had been written in utf-8, in

When i open a file in my own editor i see characters like "uĹĽy" instead
of polish characters.
When i type in my own editor i can use polish characters, and they are
displayed good.
When i edit a file and save it, i see "��" instead of polish characters.

I have tried a lot of combinations with:

@sci.style_set_character_set(STC_STYLE_DEFAULT, 0)
@sci.style_set_font_encoding(STC_STYLE_DEFAULT, FONTENCODING_UTF8)
but it didnt help

if i use to create a file and File.puts contents inside of it,
and load this script into my editor i see wrongly displayed polish
characters, but when i run a test i get correct characters in output, so
the problem is when i write sth and save it.

--code for load and save--

          file_to_edit = @listbox_added.get_selections()
          file_to_edit = file_to_edit[0]
          file_to_edit = $tests[file_to_edit]
          edited_file_to_save = @input_edit_save.get_line_text(0)
          if edited_file_to_save != ""
            f ="#{edited_file_to_save}","w") if
File.exists?("#{edited_file_to_save}") == false
            file_to_reedit = @input_edit_save.get_line_text(0)
            @mdialog_input_edit_save =,
"Name the file please", "Oops!", OK, DEFAULT_POSITION)
86d42d3251111ae7de3fab04e8eddc76?d=identicon&s=25 Maciej S. (mszatanik)
on 2010-05-28 15:14
the problem seams to be related to load_file and save_file.

            f ="#{edited_file_to_save}","w+")
            f.each do |line|
            contents_to_save = @sci.get_text#tu
            f.puts contents_to_save

works for me
072474017ee24a3489e401c775602b7d?d=identicon&s=25 Sergey C. (sergeych)
on 2010-06-06 01:44
(Received via mailing list)

Opening in 'w' mode truncates existing file to zero length, or create
new file. 'w+' is same but allow to read the file too. so, in both cases
file is clear upon opening.

line.delete does nothing there. f.each yelds lines of text read from the
file, String instances. Whatever you do with them, it does not change
the file.

28.05.2010, × 17:14, Maciej Szatanik ÎÁÐÉÓÁÌ(Á):

> works for me
> --
> Posted via
> _______________________________________________
> wxruby-users mailing list

Sergey Chernov
This topic is locked and can not be replied to.