# Retrieving the Decoded String (Safe)

This code snippet shows how to read a QR code and retrieve the decoded string.

## C++

```cpp
#include <eVision/EasyQRCode/EQRCodeReader.h>
```

```cpp
using namespace eVision;

// Image constructor
EImageBW8 srcImage;

// QR code reader constructor
EQRCodeReader reader;

// ...

// Read
std::vector<EQRCode> qrCodes = reader.Read(srcImage);

// Retrieve the data of the first QR code found
std::string decodedString = "";
try
{
  // The QR Code can be fully decoded without user input
  decodedString = qrCodes[0].GetDecodedString();
}
catch (EException exc)
{
  // Handle the exception

  // The QR Code cannot be fully decoded without user input
  // use hexadecimal byte interpretation
  decodedString = qrCodes[0].GetDecodedString(EByteInterpretationMode_Hexadecimal);
}
```

#### SEE ALSO
[`EQRCodeReader::Read`](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4), [`EQRCode::GetDecodedString`](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ae23a514a154d06ea9d9d12af88e10c49) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a6f7a215ffa51a73b191db6882c081b55) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCode.html#aff5a05f073cfdab7850290355b4bbb0b)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();

// QR code reader constructor
EQRCodeReader reader = new EQRCodeReader();

// ...

// Read
EQRCode[] qrCodes = reader.Read(srcImage);

// Retrieve the data of the first QR code found
string decodedString = "";
try
{
  // The QR Code can be fully decoded without user input
  decodedString = qrCodes[0].GetDecodedString();
}
catch (EException)
{
  // Handle the exception

  // The QR Code cannot be fully decoded without user input
  // use hexadecimal byte interpretation
  decodedString = qrCodes[0].GetDecodedString(EByteInterpretationMode.Hexadecimal);
}
```

#### SEE ALSO
[`EQRCodeReader.Read`](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4), [`EQRCode.GetDecodedString`](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a6f7a215ffa51a73b191db6882c081b55) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ae23a514a154d06ea9d9d12af88e10c49) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCode.html#aff5a05f073cfdab7850290355b4bbb0b)

## Python

```py
import eVision
src_image = eVision.EImageBW8()

# QR code reader constructor
reader = eVision.EQRCodeReader()

# ...

# Read
qr_codes = reader.Read(src_image)

# Retrieve the data of the first QR code found
decoded_string = ""
try:
    # The QR Code can be fully decoded without user input
    decoded_string = qr_codes[0].GetDecodedString()
except eVision.EException as exc:
    # Handle the exception

    # The QR Code cannot be fully decoded without user input
    # use hexadecimal byte interpretation
    decoded_string = qr_codes[0].GetDecodedString(eVision.EByteInterpretationMode.Hexadecimal)
```

#### SEE ALSO
[`EQRCodeReader.Read`](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877), [`EQRCode.GetDecodedString`](../../../../doxygen_python/classeVision_1_1EQRCode.html#aff5a05f073cfdab7850290355b4bbb0b) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ae23a514a154d06ea9d9d12af88e10c49) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a6f7a215ffa51a73b191db6882c081b55)
