Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with non italian characters in name and surname #54

Closed
stratio84 opened this issue Apr 1, 2021 · 3 comments · Fixed by #60
Closed

Problems with non italian characters in name and surname #54

stratio84 opened this issue Apr 1, 2021 · 3 comments · Fixed by #60
Labels
Milestone

Comments

@stratio84
Copy link

Hello Davide,

first of all thanks for your library, super useful :)

Doing some tests I think I found a bit of a problem.

If I try to validate this fiscal code:

BTENNA72D42H501M

which belongs to the following user:

Name: Anna
Surname: Betaña
Gender: Female
Date of birth: 02/04/1972
City of birth: Rome (H501)
Country of birth: Italy

the system is giving me an error stating that the fiscal code is not compatible with the user data.

This is the piece of code I'm using:

$subject = new \CodiceFiscale\Subject([
"name" => $firstname,
"surname" => $lastname,
"birthDate" => $birthday,
"gender" => $gender,
"belfioreCode" => $city
]);

    $checker = new \CodiceFiscale\Checker($subject, [
      "codiceFiscaleToCheck" => $fiscalCode,
      "omocodiaLevel" => \CodiceFiscale\Checker::ALL_OMOCODIA_LEVELS
    ]);

    return $checker->check();

From the log it seems that it's not handling well the spanish n character in the surname.

Am i doing something wrong here or is it a known issue with names and surnames containing characters belonging to different alphabets?

Thanks in advance for the help.

Gianpiero.

@DavidePastore DavidePastore added this to the future-release milestone Apr 1, 2021
@DavidePastore
Copy link
Owner

Hello @stratio84 . Thanks for using the library. Yes, I'm pretty sure this is a bug in the library. I'll take a look at it ASAP.

@stratio84
Copy link
Author

Hello Davide,

I performed some deeper checks and there's something strange.

Basically if I use the customer data, that I wrote inside my previous post, to generate the fiscale code with your library I obtain the following fiscal code:

BTNNNA72D42H501X

Snippet of code I used is the following:

$subject = new Subject(
array(
"name" => "Anna",
"surname" => "Betaña",
"birthDate" => "1972-04-02",
"gender" => "F",
"belfioreCode" => "H501"
)
);

    $calculator = new Calculator($subject);
    $fiscal = $calculator->calculate();

This fiscal code is different from the one I obtained from an online generator website using the same customer data.

So my first question is:

which code is the right one for the given customer data? :)

The second one (the one generated with your library) seems to be created after translitterating all the non italian characters into italian ones.

Is this correct? I mean when a non italian people is assigned a fiscal code in Italy what happens if he/she has some "strange" characters inside his/her name? Are they translitterated first in order to generate the fiscal code?

Thanks,

Gianpiero.

@DavidePastore
Copy link
Owner

DavidePastore commented Apr 10, 2021

Hi @stratio84, yes, the fiscal code must be made up of latin characters only. You can read more about it here. The problem is that we need to find the way the character should be converted. You can see here that it's not correct to find the "Ñ" in the fiscal code.

francescolaffi pushed a commit to francescolaffi/codice-fiscale that referenced this issue Mar 10, 2022
francescolaffi pushed a commit to francescolaffi/codice-fiscale that referenced this issue Mar 10, 2022
francescolaffi pushed a commit to francescolaffi/codice-fiscale that referenced this issue Mar 14, 2022
francescolaffi pushed a commit to francescolaffi/codice-fiscale that referenced this issue Mar 14, 2022
@DavidePastore DavidePastore modified the milestones: future-release, 0.9.0 Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants