After some quick tests, here are two methods which definitely seem to work:
1. Copy (the pipe symbol, etc. etc.) and paste directly from host to guest: for example, for |, an initial cmd-C in the host and then, when required, a cmd-V in the guest, and you are done.
2. Connect to the guest from the host with Screen Sharing (after having enabled it in the guest, of course): in this case, the keyboard mapping is the right one from the beginning (it uses the one from the host); and probably you also need bridged networking in the guest: not an ideal solution, but maybe better than the first one, if you don't mind the possible performance hit.
Any other possible solutions? Who knows...