Skip to content

Commit

Permalink
Replace \u0130 with 'i', so stuff works
Browse files Browse the repository at this point in the history
  • Loading branch information
stelar7 committed Aug 12, 2017
1 parent 90ca872 commit da21a75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/main/java/no/stelar7/api/l4j8/basic/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.Locale;
import java.util.logging.*;
import java.util.regex.Pattern;

public final class Utils
{
Expand Down Expand Up @@ -63,11 +60,13 @@ public static String normalizeSummonerName(final String data)
{
try
{
final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
final String stripped = data.replaceAll("\\s+", "");
final String normalized = Normalizer.normalize(stripped, Form.NFD);
final String lowercase = pattern.matcher(normalized).replaceAll("").toLowerCase(Locale.ENGLISH);
return URLEncoder.encode(lowercase, "UTF-8");


final String stripped = data.replaceAll("\\s+", "");
final String result = stripped.replace("\u0130", "i").toLowerCase(Locale.ENGLISH);


return URLEncoder.encode(result, "UTF-8");
} catch (final UnsupportedEncodingException e)
{
Utils.LOGGER.log(Level.WARNING, e.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public final class Constants
public static final String REQUEST_URL = PROTOCOL + PLATFORM_PLACEHOLDER + HOST_PLACEHOLDER + SEPARATOR + GAME_PLACEHOLDER + SEPARATOR + SERVICE_PLACEHOLDER + SEPARATOR + VERSION_PLACEHOLDER + SEPARATOR + RESOURCE_PLACEHOLDER;

public static final String[] TEST_TOURNAMENT_CODES = {"EUW0418b-b9423c92-5733-4d1b-aff2-215229f96e8d"};
public static final String[] TEST_SUMMONER_NAMES = {"stelar7", "相当猥琐", "RİVEN BANLAMAA"};
public static final String[] TEST_SUMMONER_NAMES = {"stelar7", "相当猥琐", "RİVEN BANLAMAA", "Elyäkâla", "Integra"};
public static final Long[] TEST_SUMMONER_IDS = {19613950L, 24582364L};
public static final Long[] TEST_ACCOUNT_IDS = {22401330L, 29061584L};
public static final Platform[] TEST_PLATFORM = {Platform.EUW1, Platform.EUW1, Platform.TR1};
public static final Platform[] TEST_PLATFORM = {Platform.EUW1, Platform.EUW1, Platform.TR1, Platform.EUW1, Platform.EUW1};
public static final Integer[] TEST_CHAMPION_IDS = {89, 50};
public static final Long[] TEST_MATCH_ID = {180100577L};

Expand Down

0 comments on commit da21a75

Please sign in to comment.