Лечим кодировку при экспорте CSV в Redmine

redmineПоставил недавно последний Redmine 2.x. Обнаружилось что при экспорте в формат CSV неверно отображаются русские символы. Поэтому в нем хочу добавить простенькое решение. Итак, открываем файл ru.yml. У меня он находится по пути:


Ищем строку с параметром general_csv_encoding и меняем значение с UTF-8 на WINDOWS-1251:

# Было
general_csv_encoding: UTF-8

# Стало
general_csv_encoding: WINDOWS-1251

Перезапускаем Redmine.

UPD От пользователя Bozo: “Экспорт в csv происходит нормально, но в utf без bom. А глупые мс-продукты при виде utf без bom сходят с ума. Так что нужно всего лишь добавлять bom к созданному csv-файлу. Это можно реализовать микро-плагином за 10 минут.”

Плагин от Bozo:

require_dependency ‘queries_helper’

module BOMFixQueriesHelperPatch
def self.included(base)
base.send(:include, InstanceMethods)

base.class_eval do
alias_method_chain :query_to_csv, :fixed_bom

module InstanceMethods

# adds bom symbols to utf-encoded csv file
def query_to_csv_with_fixed_bom *args
ret = query_to_csv_without_fixed_bom *args
if l(:general_csv_encoding) == ‘UTF-8′
ret = “\xef\xbb\xbf”+ret


27 комментариев к “Лечим кодировку при экспорте CSV в Redmine

  1. Hello there! This post could not be written any better! Looking at this post reminds me of my previous roommate! He constantly kept preaching about this. I’ll send this information to him. Pretty sure he’s going to have a great read. Thanks for sharing!

  2. There are some interesting moments in this short article yet I don?t understand if I see all of them facility to heart. There is some validity however I will certainly take hold opinion until I check out it even more. Great short article, thanks and also we want more! Included in FeedBurner also

  3. Magnificent beat ! I would like to apprentice while you amend your web site, how can i subscribe for a blog site?
    The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided
    bright clear concept cheap flights 31muvXS

  4. I was recommended this blog by way of my cousin. I’m
    no longer positive whether this publish is written via
    him as nobody else know such targeted approximately
    my difficulty. You are amazing! Thanks! cheap flights 32hvAj4

  5. There are absolutely a lot of details like that to think about. That is a fantastic indicate bring up. I offer the thoughts above as general inspiration however clearly there are questions like the one you raise where one of the most essential point will be operating in straightforward good faith. I don?t know if ideal practices have arised around things like that, however I make certain that your work is plainly determined as a fair game. Both children and also women really feel the impact of just a moment?s satisfaction, for the remainder of their lives.

  6. I uncovered your blog website on google as well as examine a few of your very early messages. Remain to maintain the great run. I simply extra up your RSS feed to my MSN Information Visitor. Seeking ahead to reading more from you later on!?

  7. I?d need to get in touch with you here. Which is not something I normally do! I appreciate reviewing an article that will make individuals think. Likewise, many thanks for allowing me to comment!

  8. Nice blog post. I learn something much more difficult on different blogs day-to-day. It will certainly always be stimulating to review web content from various other authors and practice a little something from their shop. I?d choose to use some with the content on my blog site whether you don?t mind. Natually I?ll give you a web link on your internet blog site. Thanks for sharing.

  9. Can I simply say what an alleviation to discover a person that really recognizes what theyre talking about on the web. You definitely understand exactly how to bring a concern to light as well as make it crucial. Even more people require to read this as well as recognize this side of the tale. I angle think youre not extra popular because you most definitely have the gift.

  10. Hey! Someone in my Facebook group shared this site with us, so I am looking. I really appreciate the information. I am a bookmark and will be it tweeting to my disciples! Blog design and large outstanding and style.

  11. The next time I check out a blog site, I wish that it does not dissatisfy me as high as this. I imply, I recognize it was my option to read, however I actually assumed youd have something fascinating to claim. All I listen to is a number of whining about something that you might take care of if you werent also active seeking focus.

Оставить ответ

Ваш адрес email не будет опубликован. Обязательные поля помечены *