{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/2008/08/08/svn-log-message-encoding-problem/","result":{"data":{"markdownRemark":{"html":"<p>It’s good practice to put useful commentary in the log message whenever you commit code to a repository.</p>\n<p>Today, I wrote a log message about centigrade and farenheit conversions, using the proper degree symbol °, but this triggered an encoding problem, resulting in an error message:</p>\n<pre class=\"grvsc-container grvsc-has-line-highlighting default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\">macbook:~/projects/smarty ash\\$ svn ci plugins/function.temperature.php</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">svn: Commit failed (details follow):</span></span>\n<span class=\"grvsc-line grvsc-line-highlighted\"><span class=\"grvsc-source\">svn: Can&#39;t convert string from native encoding to &#39;UTF-8&#39;:</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">svn: Tweak: altered temperature title attribute so it contains both farenheight AND</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">centigrade. e.g. &quot;88?\\\\194?\\\\176F or 17?\\\\194?\\\\176C&quot;. The order is switched depending on user</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">preference.</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">--This line, and those below, will be ignored--</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">M function.temperature.php</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">svn: Your commit message was left in a temporary file:</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">svn: &#39;/Users/ash/projects/propagandr/smarty/plugins/svn-commit.tmp&#39;</span></span></code></pre>\n<p>It didn’t take long to realize although my editor (vim) was configured to use UTF-8, the subversion command-line client had no way of knowing that.</p>\n<p>One way of stopping this happening again would be to set my locale permanently so the character-type is UTF-8 (e.g. <code>export LC_CTYPE=en.UTF-8</code>.) But, as a short-term one-off fix, avoiding retyping the log message (and a little off-topic: remembering subversion ignores filenames mentioned in log messages, forcing you to re-enter them on the command-line again) - the simple fix was:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">LC_CTYPE=en_GB.UTF-8 svn ci -F plugins/svn-commit.tmp plugins/function.temperature.php</span></span></span></code></pre>\n<p>Worked like a charm.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    position: relative;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n    line-height: 1.4;\n  }\n  \n  .grvsc-code {\n    display: table;\n  }\n  \n  .grvsc-line {\n    display: table-row;\n    box-sizing: border-box;\n    width: 100%;\n    position: relative;\n  }\n  \n  .grvsc-line > * {\n    position: relative;\n  }\n  \n  .grvsc-gutter-pad {\n    display: table-cell;\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  .grvsc-gutter {\n    display: table-cell;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter::before {\n    content: attr(data-content);\n  }\n  \n  .grvsc-source {\n    display: table-cell;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-source:empty::after {\n    content: ' ';\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter + .grvsc-source {\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  /* Line transformer styles */\n  \n  .grvsc-has-line-highlighting > .grvsc-code > .grvsc-line::before {\n    content: ' ';\n    position: absolute;\n    width: 100%;\n  }\n  \n  .grvsc-line-diff-add::before {\n    background-color: var(--grvsc-line-diff-add-background-color, rgba(0, 255, 60, 0.2));\n  }\n  \n  .grvsc-line-diff-del::before {\n    background-color: var(--grvsc-line-diff-del-background-color, rgba(255, 0, 20, 0.2));\n  }\n  \n  .grvsc-line-number {\n    padding: 0 2px;\n    text-align: right;\n    opacity: 0.7;\n  }\n  \n  .default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .default-dark .mtk1 { color: #D4D4D4; }\n  .default-dark .grvsc-line-highlighted::before {\n    background-color: var(--grvsc-line-highlighted-background-color, rgba(255, 255, 255, 0.1));\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, rgba(255, 255, 255, 0.5));\n  }\n</style>","timeToRead":1,"frontmatter":{"title":"SVN log message encoding problem","blurb":"A quick tip on setting the character-encoding for a Subversion commit message from the command-line","date":"2008-08-08T11:03:12.000Z","modified":"2011-01-03T17:20:14.000Z"}}},"pageContext":{"slug":"/blog/2008/08/08/svn-log-message-encoding-problem/","next":{"fields":{"slug":"/blog/2008/08/20/php-session-management-grievance-2/"},"frontmatter":{"title":"PHP Session Management (grievance 2)"}},"previous":{"fields":{"slug":"/blog/2008/07/22/tweaking-png-transparency-with-imagemagick/"},"frontmatter":{"title":"Tweaking PNG transparency with ImageMagick"}}}},"staticQueryHashes":["1192980692"]}