Question: I'm trying to ask a user to enter two binary sequences and check if they are valid. here is my code.

```
char seq1[8], seq2[8];
printf("Enter 1st 8-bit sequence: ");
scanf("%8s", seq1);
getchar();
printf("\nEnter 2nd 8-bit sequence: ");
scanf("%8s", seq2);
getchar();
printf("\n");
printf("%s\n", seq1);
printf("%s\n", seq2);

if(strlen(seq1) < 8 || strlen(seq2) < 8){
    printf("Error: must enter 8-bits\n");
    exit(1);
}
for(int i = 0; seq1[i]!='\0'; i++){
    if(seq1[i]>48||seq1[i]<49){
        printf("Error: non-binary detected\n");
        exit(1);
    }

}
for(int i = 0; seq2[i]!='\0'; i++){
    if(seq2[i]>48||seq2[i]<49){
        printf("Error: non-binary detected\n");
        exit(1);
    }

}

```

When printing the strings I get the second string (seq2) added onto the end of seq1, and it always comes back as "Non-binary detected" even if it's all 1's and 0's. 

[example](https://i.stack.imgur.com/nsjT9.png)

Answer: 
As mentioned by several others, some platforms such as Windows don't support country flags (see <https://answers.microsoft.com/en-us/windows/forum/all/flag-emoji/85b163bc-786a-4918-9042-763ccf4b6c05?page=1> for a longer discussion on why this might be the case).

I ended up using a script for replacing my emojis with pngs. I thought this might be helpful for others, so here you go

HTML-version:

```
<html>
<body>
    <h1>      </h1>
    <p>Lets test more emoji replacement    .</p>
</body>
<script>
const flagemojiToPNG = (flag) => {
    var countryCode = Array.from(flag, (codeUnit) => codeUnit.codePointAt()).map(char => String.fromCharCode(char-127397).toLowerCase()).join('')
    return "<img src='https://flagcdn.com/24x18/" + countryCode + ".png'>"
}
    var reg = new RegExp('(?:\ud83c[\udde6-\uddff]){2}', 'g');
    document.body.innerHTML = document.body.innerHTML.replaceAll(reg, flagemojiToPNG);
</script>
    </html>

```

React version (for replacing individual flags):

```
const flagemojiToPNG = (flag) => {
    var countryCode = Array.from(flag, (codeUnit) => codeUnit.codePointAt()).map(char => String.fromCharCode(char-127397).toLowerCase()).join('')
    return (<img src={`https://flagcdn.com/24x18/${countryCode}.png`} alt='flag' />)
}

```
Can use react-select to create dropdown with below properties.

Need to create Array of object with two-letter country code, label and value for dropdown.

```
{
      label: `india`,
      value: `+91`,
      emojiFlag: 'IN'
}

```

Code to convert two-letter country code to flag png of Flagcdn.

```
flagemojiToPNG = (flag: string) => {
    var countryCode = Array.from(flag, (codeUnit: any) => codeUnit.codePointAt()).map(char => String.fromCharCode(char-127397).toLowerCase()).join('')
    return (<img src={`https://flagcdn.com/24x18/${countryCode}.png`} alt='flag' />)
  }

Import Select from 'react-select';
<Select
          options={dataSource}
          formatOptionLabel={data => (
            <>{flagemojiToPNG(data.emojiFlag)}  {data.label}</>
          )}
          placeholder={"Select Country"}
          onChange={}
          value={}
        />

```

Can render image on React select with formatOptionLabel Prop of React-select.
datasource- Will be your dropdown's datasource.