zio / zio-redis

A ZIO-based redis client
https://zio.github.io/zio-redis
Apache License 2.0
123 stars 63 forks source link

Use of accents causes fiber to get stuck #898

Closed julioselva closed 5 months ago

julioselva commented 10 months ago

These are some of the characters that cause the issue: é, ú, ã, ç... Same happens when supplying the JsonCodec.schemaBasedBinaryCodec or CodecSupplier.utf8string

import zio._
import zio.redis._
import zio.schema._
import zio.schema.codec._

object ZIORedisExample extends ZIOAppDefault {

  object ProtobufCodecSupplier extends CodecSupplier {
    def get[A: Schema]: BinaryCodec[A] = ProtobufCodec.protobufCodec
  }

  val myApp: ZIO[Redis, RedisError, Unit] =
    for {
      redis <- ZIO.service[Redis]
      r1    <- redis.set(s"string", "ç")
      _     <- ZIO.log(s"string was set? $r1")                // string was set? true
      r2    <- redis.get(s"string").returning[String]
      _     <- ZIO.log(s"string was gotten? ${r2.isDefined}") // this will never be printed
    } yield ()

  override def run = myApp.provide(
    Redis.layer,
    RedisExecutor.layer,
    ZLayer.succeed(RedisConfig.Default),
    ZLayer.succeed[CodecSupplier](ProtobufCodecSupplier),
  )

}