What are the potential pitfalls to be aware of when generating images with text using GD in PHP?

One potential pitfall when generating images with text using GD in PHP is not properly handling special characters or encoding issues. To avoid this, make sure to properly encode text using functions like `utf8_encode()` or `mb_convert_encoding()` before adding it to the image.

// Example code snippet to properly encode text before adding it to an image
$text = "Special character: é";
$encoded_text = utf8_encode($text);

// Add encoded text to image
imagettftext($image, $size, $angle, $x, $y, $color, $font, $encoded_text);