Pololu Magnetic Encoder 12cpr

Thank you for your reply. I appreciate it a lot. I used this code to read a rotary encoder with 256 cpr. and it seemed to be working right or at least outputting the write output which is 256 in one full rotation. I need to admit I am a little bit lost about reading encoder using interrupts. Does this mean I need to have two ISR one for A and one for B? why? if yes, I need to attach two interrupts as well for pinA and Pin B? why?. How do I properly read all the available quadrature transitions?
I used the example provided from the Arduino playground. I really hope I can get guidance in the code and hoping I will get a fully understanding of reading encoders using interrupts.

void isr_A(){

  
flag = true;
  if(digitalRead(encoderPinA) == HIGH){
    if(digitalRead(encoderPinB) == LOW){
      counter = counter -1; //COUNTER CLOCK WISE
    }
    else{
      counter = counter +1; //CLOCK WISE
    }
  }
  else{ //IF PIN A IS LOW
    if(digitalRead(encoderPinB) == LOW){
      counter = counter +1; //CLOCK WISE
    }
    else{
      counter = counter -1 ; //COUNTER CLOCK WISE
    }
  }
  
}

void isr_B(){

  
flag = true;
  if(digitalRead(encoderPinB) == HIGH){
    if(digitalRead(encoderPinA) == HIGH){
      counter = counter + 1; //COUNTER CLOCK WISE
    }
    else{
      counter = counter -1; //CLOCK WISE
    }
  }
  else{ //IF PIN A IS LOW
    if(digitalRead(encoderPinA) == LOW){
      counter = counter +1; //CLOCK WISE
    }
    else{
      counter = counter -1 ; //COUNTER CLOCK WISE
    }
  }
  attachInterrupt(digitalPinToInterrupt(encoderPinA), isr_A, RISING); //INTERRUPT
  attachInterrupt(digitalPinToInterrupt(encoderPinA), isr_B, RISING); //INTERRUPT