Text this: A Compact and Fast Resonant Cavity-Based Encoder in Photonic Crystal Platform