# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+require 'iconv'
+
class Changeset < ActiveRecord::Base
belongs_to :repository
has_many :changes, :dependent => :delete_all
end
def comments=(comment)
- write_attribute(:comments, comment.strip)
+ write_attribute(:comments, to_utf8(comment.to_s.strip))
end
def committed_on=(date)
def next
@next ||= Changeset.find(:first, :conditions => ['id > ? AND repository_id = ?', self.id, self.repository_id], :order => 'id ASC')
end
+
+ private
+
+ def to_utf8(str)
+ return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
+ encoding = Setting.commit_logs_encoding.to_s.strip
+ unless encoding.blank? || encoding == 'UTF-8'
+ begin
+ return Iconv.conv('UTF-8', encoding, str)
+ rescue Iconv::Failure
+ # do nothing here
+ end
+ end
+ str
+ end
end
'%H:%M',
'%I:%M %p'
]
+
+ ENCODINGS = %w(US-ASCII
+ windows-1250
+ windows-1251
+ windows-1252
+ windows-1253
+ windows-1254
+ windows-1255
+ windows-1256
+ windows-1257
+ windows-1258
+ windows-31j
+ ISO-2022-JP
+ ISO-2022-KR
+ ISO-8859-1
+ ISO-8859-2
+ ISO-8859-3
+ ISO-8859-4
+ ISO-8859-5
+ ISO-8859-6
+ ISO-8859-7
+ ISO-8859-8
+ ISO-8859-9
+ ISO-8859-13
+ ISO-8859-15
+ KOI8-R
+ UTF-8
+ UTF-16
+ UTF-16BE
+ UTF-16LE
+ EUC-JP
+ Shift_JIS
+ GB18030
+ GBK
+ ISCII91
+ EUC-KR
+ Big5
+ Big5-HKSCS
+ TIS-620)
cattr_accessor :available_settings
@@available_settings = YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml"))
<p><label><%= l(:setting_repositories_encodings) %></label>
<%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p>
+
+<p><label><%= l(:setting_commit_logs_encoding) %></label>
+<%= select_tag 'settings[commit_logs_encoding]', options_for_select(Setting::ENCODINGS, Setting.commit_logs_encoding) %></p>
</div>
<fieldset class="box tabular settings"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
# multiple values accepted, comma separated
repositories_encodings:
default: ''
+# encoding used to convert commit logs to UTF-8
+commit_logs_encoding:
+ default: 'UTF-8'
ui_theme:
default: ''
emails_footer:
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
setting_cross_project_issue_relations: Allow cross-project issue relations
setting_issue_list_default_columns: Default columns displayed on the issue list
setting_repositories_encodings: Repositories encodings
+setting_commit_logs_encoding: Commit messages encoding
setting_emails_footer: Emails footer
setting_protocol: Protocol
setting_per_page_options: Objects per page options
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
setting_cross_project_issue_relations: Autoriser les relations entre demandes de différents projets
setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes
setting_repositories_encodings: Encodages des dépôts
+setting_commit_logs_encoding: Encodage des messages de commit
setting_emails_footer: Pied-de-page des emails
setting_protocol: Protocole
setting_per_page_options: Options d'objets affichés par page
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Az E-mail küldés nincs konfigurálva, és az értesítések ki vannak kapcsolva.\nÁllítsd be az SMTP szervert a config/email.yml fájlban és indítsd újra az alkalmazást, hogy érvénybe lépjen."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "La consegna via e-mail non è configurata e le notifiche sono disabilitate.\nConfigura il tuo server SMTP in config/email.yml e riavvia l'applicazione per abilitarle."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."\r
field_parent_title: Parent page\r
label_issue_watchers: Watchers\r
+setting_commit_logs_encoding: Commit messages encoding\r
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Параметры работы с почтовым сервером не настроены и функция уведомления по email не активна.\nНастроить параметры для вашего SMTP сервера вы можете в файле config/email.yml. Для применения изменений перезапустите приложение."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
enumeration_activities: 活動 (時間追蹤)
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding
text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/email.yml and restart the application to enable them."
field_parent_title: Parent page
label_issue_watchers: Watchers
+setting_commit_logs_encoding: Commit messages encoding