# Buggy code
def load_config(
    self,
    config_path: str,
    is_primary_config: bool,
    package_override: Optional[str] = None,
) -> ConfigResult:
    normalized_config_path = self._normalize_file_name(config_path)
    full_path = os.path.realpath(os.path.join(self.path, normalized_config_path))
    if not os.path.exists(full_path):
        raise ConfigLoadError(f"Config not found : {full_path}")

    with open(full_path) as f:
        header_text = f.read(512)
        header = ConfigSource._get_header_dict(header_text)
        self._update_package_in_header(
            header=header,
            normalized_config_path=normalized_config_path,
            is_primary_config=is_primary_config,
            package_override=package_override,
        )
        f.seek(0)
        cfg = OmegaConf.load(f)
        return ConfigResult(
            config=self._embed_config(cfg, header["package"]),
            path=f"{self.scheme()}://{self.path}",
            provider=self.provider,
            header=header,
        )


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\utils.py", line 198, in run_and_report
return func()
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\utils.py", line 350, in <lambda>
overrides=args.overrides,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\hydra.py", line 104, in run
run_mode=RunMode.RUN,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\hydra.py", line 512, in compose_config
from_shell=from_shell,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 156, in load_configuration
from_shell=from_shell,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 262, in _load_configuration
run_mode=run_mode,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 805, in _merge_defaults_into_config
hydra_cfg = merge_defaults_list_into_config(hydra_cfg, user_list)
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 793, in merge_defaults_list_into_config
package_override=default1.package,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 698, in _merge_config
package_override=package_override,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_loader_impl.py", line 592, in _load_config_impl
package_override=package_override,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\config_repository.py", line 48, in load_config
package_override=package_override,
File "C:\Users\user\anaconda3\envs\poolobs\lib\site-packages\hydra\_internal\core_plugins\file_config_source.py", line 33, in load_config
header_text = f.read(512)
File "C:\Users\user\anaconda3\envs\poolobs\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 117: character maps to <undefined>

# Fixed code
def load_config(
    self,
    config_path: str,
    is_primary_config: bool,
    package_override: Optional[str] = None,
) -> ConfigResult:
    normalized_config_path = self._normalize_file_name(config_path)
    full_path = os.path.realpath(os.path.join(self.path, normalized_config_path))
    if not os.path.exists(full_path):
        raise ConfigLoadError(f"Config not found : {full_path}")

    with open(full_path, encoding="utf-8") as f:
        header_text = f.read(512)
        header = ConfigSource._get_header_dict(header_text)
        self._update_package_in_header(
            header=header,
            normalized_config_path=normalized_config_path,
            is_primary_config=is_primary_config,
            package_override=package_override,
        )
        f.seek(0)
        cfg = OmegaConf.load(f)
        return ConfigResult(
            config=self._embed_config(cfg, header["package"]),
            path=f"{self.scheme()}://{self.path}",
            provider=self.provider,
            header=header,
        )