hm
authorJoey Hess <joeyh@joeyh.name>
Fri, 22 Sep 2023 19:06:30 +0000 (15:06 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 22 Sep 2023 19:06:30 +0000 (15:06 -0400)
doc/bugs/__34__git_annex_adjust__34___does_not_respect_utf8_in_the_commit_author_field/comment_2_d28894bc233987f68159e8d1a7a97096._comment

index a1d4c8ac3a29274459ad7f571b898829bc30392a..f6221211e0222477a4e34b7ea8991f47ce3df845 100644 (file)
@@ -22,11 +22,10 @@ What seems to be happening is that catCommit gets:
 
        commitName = Just "F\56515\56489lix"
 
-Which is I think ok, that's a utf-8 surrogate. But then 
-that's passed into commitWithMetaData, which sets the environment
-variable to its content. And setting an environment variable to a String
-like that does not pass it through the filesystem encoding. And so the
-utf-8 surrogate is not converted back to the right bytes.
+Which is I think ok, that's a utf-8 surrogate in the filesystem encoding.
+Then that's passed into commitWithMetaData, which sets the environment
+variable to its content. And apparently it fails to be converted back to
+the right bytes.
 
 One fix would be to keep it a ByteString all the way though, using
 `System.Posix.Env.ByteString`. I tried converting all environment in
@@ -38,6 +37,15 @@ variable that for some reason needs to get set by git-annex would
 not incur mojibake -- it doesn't seem possible with the current library
 ecosystem.
 
-So, I think the best fix is to avoid commitWithMetaData using environment
-variables.
+I tried making commitWithMetaData set the env var to a String that
+had the filesystem encoding applied. Eg `w82s (S.unpack (encodeBS v))`.
+Interestingly, that failed:
+
+git-annex: git: recoverEncode: invalid argument (cannot encode character '\195')
+
+Which looks like the filesystem encoding is being applied after all?
+And in System.Process.Posix, it does look like it does,
+withCEnvironment uses withFilePath on the contents of env.
+
+So huh, why then does the value not roundtrip?
 """]]