I formated the phone, I set a pattern and I successfully encrypted the phone.
If after trying again your phone isn’t encrypted, I suggest you to also format the data partition (it will erase all your data) :
- turn off your phone,
- long press on Power + Home + volume plus buttons for 10 seconds to enter into TWRP (the recovery mode),
- if a warning appears, swipe “Swipe to allow modifications”,
- click on “Wipe” then “Format Data”,
- enter “yes” and confirm,
- click on Reboot System (and “Do Not Install” if it appears).
Set your pattern and try to encrypt again.