diff --git a/library/PtrPoker/ByteString.hs b/library/PtrPoker/ByteString.hs
--- a/library/PtrPoker/ByteString.hs
+++ b/library/PtrPoker/ByteString.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 module PtrPoker.ByteString where
 
 import Data.ByteString
@@ -7,6 +9,7 @@
 import qualified Data.ByteString.Builder.Scientific as ScientificBuilder
 import Data.ByteString.Internal
 import qualified Data.ByteString.Lazy as Lazy
+import qualified Data.Text.Encoding as TextEncoding
 import qualified PtrPoker.Ffi as Ffi
 import PtrPoker.Prelude hiding (empty)
 import qualified PtrPoker.Text as Text
@@ -40,9 +43,13 @@
 
 {-# INLINEABLE textUtf8 #-}
 textUtf8 :: Text -> ByteString
+#if MIN_VERSION_text(2,0,0)
+textUtf8 t = TextEncoding.encodeUtf8 t
+#else
 textUtf8 = Text.destruct $ \arr off len ->
   if len == 0
     then empty
     else unsafeCreateUptoN (len * 3) $ \ptr -> do
       postPtr <- inline Ffi.encodeText ptr arr (fromIntegral off) (fromIntegral len)
       return (minusPtr postPtr ptr)
+#endif
diff --git a/library/PtrPoker/Poke.hs b/library/PtrPoker/Poke.hs
--- a/library/PtrPoker/Poke.hs
+++ b/library/PtrPoker/Poke.hs
@@ -1,5 +1,9 @@
+{-# LANGUAGE CPP #-}
+
 module PtrPoker.Poke where
 
+import qualified Data.Text.Array as TextArray
+import qualified Data.Text.Internal as TextInternal
 import qualified PtrPoker.Ffi as Ffi
 import qualified PtrPoker.IO.ByteString as ByteStringIO
 import qualified PtrPoker.IO.Prim as PrimIO
@@ -140,8 +144,15 @@
 -- Encode Text in UTF8.
 {-# INLINE textUtf8 #-}
 textUtf8 :: Text -> Poke
+#if MIN_VERSION_text(2,0,0)
+textUtf8 (TextInternal.Text arr off len) =
+  Poke (\p -> do
+    stToIO $ TextArray.copyToPointer arr off p len
+    pure (plusPtr p len))
+#else
 textUtf8 = Text.destruct $ \arr off len ->
   Poke (\p -> Ffi.encodeText p arr (fromIntegral off) (fromIntegral len))
+#endif
 
 -- * ASCII integers
 
diff --git a/library/PtrPoker/Size.hs b/library/PtrPoker/Size.hs
--- a/library/PtrPoker/Size.hs
+++ b/library/PtrPoker/Size.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
 -- |
 -- Functions that compute the required allocation size by value.
 module PtrPoker.Size where
@@ -201,6 +203,9 @@
 -- in UTF8.
 {-# INLINE textUtf8 #-}
 textUtf8 :: Text -> Int
+#if MIN_VERSION_text(2,0,0)
+textUtf8 = Text.destruct $ \_arr _off len -> len
+#else
 textUtf8 = Text.destruct $ \arr off len ->
   Ffi.countTextAllocationSize
     arr
@@ -208,3 +213,4 @@
     (fromIntegral len)
     & unsafeDupablePerformIO
     & fromIntegral
+#endif
diff --git a/ptr-poker.cabal b/ptr-poker.cabal
--- a/ptr-poker.cabal
+++ b/ptr-poker.cabal
@@ -1,5 +1,5 @@
 name: ptr-poker
-version: 0.1.2.3
+version: 0.1.2.4
 synopsis: Pointer poking action construction and composition toolkit
 homepage: https://github.com/nikita-volkov/ptr-poker
 bug-reports: https://github.com/nikita-volkov/ptr-poker/issues
@@ -40,7 +40,7 @@
     base >=4.11 && <5,
     bytestring >=0.10 && <0.12,
     scientific >=0.3.6.2 && <0.4,
-    text >=1 && <2
+    text >=1 && <3
 
 test-suite test
   type: exitcode-stdio-1.0
