babashka 2025-09-25

I'm trying to reproduce a problem on Windows in powershell with unicode characters. I've made a repro in the form of this binary: https://github.com/borkdude/graal-repros/actions/runs/18003635773/artifacts/4102737916 Can any of you on Windows try to run this in Powershell 7 and tell me what it prints (screenshot would be fine too) in 🧡 ? The code for the repro is: https://github.com/borkdude/graal-repros/tree/init-at-build-time-output-writer-repro

well, after reading over that original issue, let me just take a minute to say thanks for all the amazing tools you've contributed to this community and the constant stream of improvements and fixes and new features you somehow manage to deliver in response to every passing comment.

❀️ 1

Thanks! Can you try setting $OutputEncoding = [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new() and running it again?

Interesting... Can you now try bb latest with this program?

(prn :> (System/getProperty "file.encoding"))

(alter-var-root #'*out* (constantly (new java.io.OutputStreamWriter System/out)))

(do
  (prn "β„’")
  (prn "Ξ»")
  (.println System/out "βš™οΈ")
  (prn "δΈ­ζ–‡"))

(binding [*out* *out* #_(java.io.OutputStreamWriter. System/out #_(java.nio.charset.Charset/forName "UTF-8"))]
  (println "βœ“ works")
  (prn "βš™οΈ"))

try it with and without the alter-var-root

ok, can you now uncomment in the right version the #_ in the binding and then once more (so with and without th explicit encoding)?

What I'm trying to figure out is why resetting *out* to something that looks the same makes things work. My hypothesis is that init at build time of *out* somehow captures the wrong encoding. But that doesn't manifest itself in the repro.

hopefully I understood what you meant here:

πŸ‘ 1

not sure if this is expected, but I see different results with a script vs evaling:

this might be expected since *out* is dynamically bound there. can you try (set! *out* ...) there instead?

also try the binding with the #_ uncommented

I made a "fix" in this bb binary. you can also test with that one? without the alter-var-root etc it should now work (hopefully 🀞 ) https://github.com/babashka/babashka/actions/runs/18005507477/artifacts/4103448816

looks like the variant without alter-var-root is still not working

are you sure you have downloaded the binary? I couldn't in an incognito window facepalm

I believe so, it's showing version v1.12.209-SNAPSHOT.

interesting. so I guess as long as you're logged in with Github you can download it

ok, let me try something different\

yeah, I did have to sign in, but ran into that downloading the original repro πŸ™‚

About to start a long block of meetings so I might be even slower to respond, but happy to help try anything else.

This one worked for me no matter what I did (alter-var-root etc): https://github.com/babashka/babashka/actions/runs/18006768113/artifacts/4103894502 I still had to set the UTF-8 output in powershell though.

$OutputEncoding = [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()

looks good

πŸŽ‰ 1

I'm completely new to Babashka, and have a question: does it support extending a defrecord with a java interface? Asking because tests fail on CI when running under Babashka runtime:

(defrecord Foobar [key value]
  ^--- defrecord/deftypecurrently only support protocol implementations,
  ^--- found: clojure.lang.Indexed
  clojure.lang.Indexed
  (nth [_ i]
    (case (long i)...

no, it doesn't support it, which the error message attempts to convey but apparently not successfully :)

(it's not that bb doesn't want t support it but it can't due to limitations of graalvm)

No-no it's pretty clear, I was asking just to ensure

I'm building a simple MCP server mock for integration testing #eca using MCP java sdk library. I'm facing a Unable to resolve classname: com.fasterxml.jackson.databind.ObjectMapper , just throwing here if anyone knows if ObjectMapper class can be used with bb

βœ… 1

I see it in bb print-deps --format classpath

and I'm using like

(ns mcp-server-sample.main
  (:import
   [com.fasterxml.jackson.databind ObjectMapper]
   [io.modelcontextprotocol.server.transport StdioServerTransportProvider]))

(StdioServerTransportProvider. (ObjectMapper.))

Nvm, I found a constructor that didn't need the objectMapper but now I'm facing the same but for https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/server/McpServer.java class

Maybe it's just not bb compatible

not sure I need to do anything

Actually it's not finding any class from mcp java sdk, maybe bb doesn't allow third party java libs?

no third party java libs unless included in the image

you can still use regular clojure though :)

yeah, I went with that in the end hehe Too used to use bb for everything πŸ˜…

❀️ 1

If any of you had a problem with Unicode in powershell (7) on Windows with bb, give this a try: https://github.com/babashka/babashka/issues/1009#issuecomment-3335943986

πŸ‘€ 2
πŸš€ 3