Closed HenrikBengtsson closed 2 years ago
Not sure why, but it needs to be fixed as well.
Turns out that contrary to cat()
, message()
, warning()
, etc. by themselves do not support UTF-8;
> cat("\u2713 Everything is OK\n")
✓ Everything is OK
> message("\u2713 Everything is OK")
<U+2713> Everything is OK
> warning("\u2713 Everything is OK")
Warning message:
<U+2713> Everything is OK
However, the following works
> c <- simpleMessage("\u2713 Everything is OK\n")
> message(c)
✓ Everything is OK
> str(c)
List of 2
$ message: chr "<U+2713> Everything is OK\n"
$ call : NULL
- attr(*, "class")= chr [1:3] "simpleMessage" "message" "condition"
> c
<simpleMessage: ✓ Everything is OK
> conditionMessage(c)
[1] "✓ Everything is OK\n"
The problem seems to be .makeMessage()
used by message()
et al.;
> msg <- .makeMessage("\u2713 Everything is OK\n")
> msg
[1] "<U+2713> Everything is OK\n"
which in turn happens because of gettext()
;
> gettext("\u2713 Everything is OK\n")
[1] "<U+2713> Everything is OK\n"
The above is with R 4.1.2 on MS Windows. In R-devel (4.2.0), R supports UTF-8 out of the box;
> message("\u2713 Everything is OK")
✓ Everything is OK
> gettext("\u2713 Everything is OK\n")
[1] "✓ Everything is OK\n"
So, the question is whether to work around this in future or not. In #473, the argument what that value(future(cat("\u2713 Everything is OK\n")))
should output the same as cat("\u2713 Everything is OK\n")
, so that one was obvious. However, if we use the same argument for conditions, then value(future(message("\u2713 Everything is OK")))
already outputs the same as message("\u2713 Everything is OK")
. Because this is a problem with message()
et al., I argue there is nothing to fix in future.
We've already fixed the following (Issue #473):
But it turns out this is a problem also conditions:
Not sure why, but it needs to be fixed as well.